random even number in Objective-C? -
i know :
randnum = arc4random_uniform(n);
will set randnum random number 0 n - 1.
however how can modify above statement random number 0 n - 1?
it faster using bitwise operator, clear lowest bit @gallymon said.
unsigned int evennumber = arc4random_uniform(n) & 0xfffffffe ;
Comments
Post a Comment