Creating random numbers in Objective-C for iPhone SDK

I used the arc4random () function to generate a random group and sequence of numbers, but I was told that this was redundant, and I should use the random () function instead. However, the random () function gives me the same group and sequence of numbers every time.

I call srand (time (0)) once when my application starts up first to seed the random () function. Do you ever need to move the random () function?

Did I miss something?

Thanks.

+5
source share
2 answers

-, , arc4random ? , () , () ( , ), () , , "overkill".

-, srand() rand(), random(), . , - .

+4

, . , , , . .

+2

All Articles