Generating Random Numbers
I am making this small program wich generates random numbers in order to make random sums. I checked the toturial to see how to generate random numbers using the system time, wich is never the same ofcourse. The problem is that I need to generare multiple random numbers at exactly the same time.
This is a piece of code I used. It will generate differend numbers IF the user does not press enter 3 times a second..
cout<<"Strike any key to generate first value";
sumvalueA = rand() % (lowX-highY/lowX)+lowX;
cout<<"Strike any key to generate second value";
sumvalueB = rand() % (lowX-highY/lowX)+lowX;
cout<<"Strike any key to generate random sum";
randomsum= rand() % (randsumX-randsumY/randsumX)+randsumX;
The outcome was 3 different values when the user waited a while before pressing a key, but faster pressing a key would make the same values. :(
Is there a different way of creating random numbers, without having to use the system time??