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

Popular posts from this blog

rdbms - what exactly the undo information lives in oracle? -

bash - How do you programmatically add a bats test? -

java - Getting exception in JDBC thin driver -