Random number in Objective C iPhone

To get a random number in iPhone Objective-C,


srandom(CFAbsoluteTimeGetCurrent());
int offset = random() % 30; // Here 30 can be replaced by any integer

Now offset is the random number.

Comments

Popular posts from this blog

Integrating ZXing QR Code reader in iPhone / iOS applications

Multiple line of text in UIPickerView

Connect Samsung devices to Kies on Mac