I need generate random numbers in my iPhone game. I using rand() function. But it isn't enough random. I tried using srand with time(Null). But my random generator was periodic. /dev/random isn't an answer because I need new random number each 0.1 sec.
On iOS and OS X, use arc4random instead. Higher quality randomness, and no need to worry about seeding.
However, rand()
shouldn't be noticably periodic, unless you're calling srand
each time around. Or using the random numbers incorrectly.