The problem with arc4random() is that it does not generate the numbers with the same probability.
I imagine you must be using arc4random() this way:
arc4random() % number;
Beneath the cloths, arco4random() does not give the same numerical probability. There is a long discussion about it but nothing like looking at the documentation to understand the essentials:
arc4random_uniform() will return a uniformly distributed random number less than upper_bound.
arc4random_uniform() is recommended over constructions like ``arc4random() % upper_bound'' as it avoids
"modulo bias" when the upper bound is not a power of two.
That is, if you use arc4random_uniform, you have a better distribution.
Already not to repeat the last, for safety, it is better to draw again if the previous number is equal to the drawn.
I hope it helps.
According to Apple’s documentation, arc4random generates random numbers uniformly and should not generate repeated numbers. Add the code where the function is being called, so it will be easier to find out what the problem is.
– Bernardo Botelho