Replace deprecated srand() and rand() with arc4random_uniform()