Replace rand() with arc4random_uniform()

With `CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND` on, `rand()` produces a warning.

This patch turns on `CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND` and switches to `arc4random_uniform(N)`. This:

1. Fixes the warning.
2. Provides better random numbers.
3. Avoids to the modulo bias.

The latter two aren't that important, but they're nice bonuses for fixing an analyzer warning.

Note: Actually turning on `CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND` is not strictly necessary. Feel free to ignore this commit. I wanted to demonstrate the setting that caused the warning, however.