Hi, I have used random numbers in several programs, such as blackjack, to create arrays of random integers, and I can easily generate them. However, when I try to generate a single random number, I believe that it the generator bases the randomness off of each second instead of millisecond, and it seems to be generating them in multiples of 3.
Since you have seeded the number with the time, the number sequences are based on an algorithm that takes the current time as an input. Hence, the first number of the sequence has a relation with the current time. The numbers in a particular sequence (i.e. the ones in the loop) are pseudorandom, not a series of numbers which are the first calls to the function.
Thanks, xkcd83, I understand now that even if I make an random number array alone, the first number is still consecutive in multiples of 3 if I repetitively start the program. Is there a way to avoid this? Ultifinitus, my random number generation goes something like this: 3, 6, 9, 9, 12, 15, ...
I just realized that my problem is that the srand reads initially from the time, but it is read in seconds, not milliseconds, so if I were to start the program twice in the same second, it will generate the same number twice. Is there any way to get it to read from milliseconds instead?