Im trying to load random numbers into array, but not having much luck. Because i am seeding from time() in a While loop, the time has not changed by the time the loop exists. So, im getting an array with the same (or a very limited range) numbers. Here is the code:
srand() initializes the PRNG. time(0) returns the number of seconds since midnight, but since the computer can generate many numbers per second, it's very likely for each call to time(0) to return the same number, so rand() ends up always returning the same number.
To avoid this, call srand() just once at the beginning of the program.