Is arc4random() thread safe?

I have seen many articles recommending the usage of `arc4random()` and `arc4random_uniform()`. But are these methods thread safe?

They are. You can see this in the Darwin open source code for these routines.

However, if you're trying to generate a small number of cryptographically sound random numbers—for a symmetric cypher IV, for example—I generally recommend SecRandom.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Is arc4random() thread safe?
 
 
Q