Asked 30+ days ago
17 Nov 2016
Views 222

jaggy posted

what is alternative function in Objective C as like php rand() function ?


i know the PHP very well but learning the Objective C in ios and want to know if function related to generate random no as we do in php with rand()

echo rand();//it will print random number with each run it generate unique no.

what is function in Objective C for generating random Number ?
Mitul Dabhi

Mitul Dabhi
answered Feb 20 '18 20:16

arc4random() is the function to generate random number

int rand = arc4random();

hope it help
Edit Answer
Post Answer