vendredi 16 septembre 2016

Xcode 8, Swift 2.3: 'rand()' is unavailable in Swift. Use arc4random instead [duplicate]

This question already has an answer here:

Since I updated to Xcode 8 with Swift set to legacy version 2.3., I get an error when calling srand and rand.

'rand()' is unavailable in Swift. Use arc4random instead.

'srand' is unavailable in Swift. Use arc4random instead.

I need a pseudo random generator that I can seed so that it generates the same sequence of numbers each time I run it with the same seed.

Why is rand not supported anymore and what would be a solution or workaround, including a different PRNG that fulfills my requirements?




Aucun commentaire:

Enregistrer un commentaire