I am developing a program that will generate algebra problems and answers for me to use for studding at home. I need to make some random numbers but every time I try, I only get the same number every time I press refresh. How can I generate random numbers?
#include <cstdlib>
#include <ctime>
// do this once at the start of main:
srand( (unsigned)time(0) );
// do this when you want a random number:
int num = rand() % 10; // generates a number between [0..10)