What\'s the difference between arc4random and random?
random
is known to be predictable and thus not to be used for secure pseudo-random number generation. arc4random
is a newer, less predictable pseudo-random number generator. If you are not using it for anything secure, random
will work fine.
Depending on your system, random() may or may not be the old, reliable, and predictable UNIX random(). On modern FreeBSD systems, and Linux 2.6 systems that have the /dev/random device, the default random() implementation reads from /dev/random until it is exhausted. This is likely to produce somewhat better random numbers than any numerical sequence generator, depending on the sources of randomness you've stirred into /dev/random.
Consulting the documentation (man pages, etc) for the system you are deploying the program on is highly suggested.