int value = arc4random() % x; #define ARC4RANDOM_MAX 0x100000000 double val = floorf(((double)arc4random() / ARC4RANDOM_MAX) * 100.0f);