I\'m working with Swift in Ubuntu, and I am getting an error that arc4random is an unresolved identifier. More information on this known bug here. Basically, the function only e
I went with something like this for 4-digit random numbers:
#if os(Linux)
srandom(UInt32(time(nil)))
randomString = String(format: "%04d", UInt32(random() % 10000))
#else
randomString = String(format: "%04d", Int(arc4random_uniform(10000)))
#endif
Edit: Note that the call to srandom(UInt32(time(nil)))
should be outside a function/loop, otherwise it will produce the same value over and over again