My app uses random numbers. I would like to seed the random number generator so that it won't be the same every time. How might I go about doing this?
EDIT:
What parameter do I give srand() to seed the random generator with the current time?
My app uses random numbers. I would like to seed the random number generator so that it won't be the same every time. How might I go about doing this?
EDIT:
What parameter do I give srand() to seed the random generator with the current time?
This works:
let time = UInt32(NSDate().timeIntervalSinceReferenceDate)
srand(time)
print("Random number: \(rand()%10)")