Aeisys
Aeisys

Reputation: 367

Objective C: Do I have to import arc4random ( )?

I'm trying to generate a random number between 0 and 3 by saying

int i = arc4Random() % 3;

but it keeps giving me the warning "implicit declaration of function 'arc4Random' is invalid in c99

Upvotes: -2

Views: 1018

Answers (2)

Tanner
Tanner

Reputation: 186

You have a capital "R" in arc4Random. Should be: int i = arc4random % 3;.

Upvotes: 2

Mike
Mike

Reputation: 9835

Try it without the capital r

int i = arc4random() % 3;

Upvotes: 2

Related Questions