In Swift 2, we could use srand both randor random(and possibly others) to place random numbers.
Unfortunately, this does not work in Swift 3. When trying to use any of these functions, an error message appears:
error: "random ()" is not available in Swift: use arc4random instead.
arc4_randomexcellent, but I can not enter it manually .
Another option (from a previous SO post ) is to use the GameKit framework. It feels redundant (not to mention cross-platform, not just Swift) to import an entire platform for planting random numbers.
Is there an alternative?
source
share