In Swift 2, we could use srand
and rand
or random
(and probably others) to seed random numbers.
Unfortunately, this does not work in Swift 3. Trying to use any of these functions results in an error message:
error: 'random()' is unavailable in Swift: Use arc4random instead.
arc4_random
is great but, I can't seed it manually.
The other option (from the previous SO post) is to use the GameKit framework. It feels like overkill (not to mention not cross-platform and not Swift only) to import a whole Framework for random number seeding.
Is there an alternative?