I have seen some examples of the random int in Objective-C, but all people are complaining about the same number sequence every time the application runs. I have read about seeding the random number, but I am not sure what that even means.
How can a random number be generated differently every time, even after application has relaunched?
Could some data be stored in NSUserDefaults and then, depending on that, different values get generated?
I've been using
arc4random
, which you don't need to seed. You can give it a try.Here's a discussion on the Apple developer forums.
You can seed your random with the following code:
This will give you a new random sequence every time.