0
Truly random number - If srand won't generate duplicate number, what happen if the range of random number finish generated?
If 1+rand()%6 gives 1-6, does it mean after it generates 6 times the program will halt or reset the pool and generate again?
2 Antworten
+ 1
No. The output of rand and the modulo are two separate things.
rand will only start to give the same numbers after 2^32 times.
0
I know but is there a way to achieve truly random number without using mt19937 and array+rand?