3 ms·
Thanks for submission! I've had some feedback that I've made a bit of a mess with casting when trying to calculate a random number - would appreciate any best
by mathewsanders 12y ago
Thanks for submission!
I've had some feedback that I've made a bit of a mess with casting when trying to calculate a random number - would appreciate any best practices or thoughts on that...
https://gist.github.com/mathewsanders/82311409978066b02932 https://gist.github.com/mathewsanders/82311409978066b02932
- LinaLauneBaer 12y agoarc4random_uniform
- mathewsanders 12y agoyou're right, in my example arc4random_uniform works perfectly and unlike rand() you don't have to seed. delay = NSTimeInterval(arc4random_uniform(900)+100) / 1000 Not sure why I didn't do that in the first place...