Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-28-2008, 07:58 AM   #8 (permalink)
trapper
I am evil trapper
 
Join Date: Jul 2008
Location: London
Posts: 299
trapper is on a distinguished road
Default

Seen this before on another forum - but haven't tried it out myself yet.

Quote:
I use these defines for random int's. I call RANDOM_SEED() once in my app, the call something lie RANDOM_INT(1,10) will return a random number between 1 and 10. Works great.


#define RANDOM_SEED() srandom(time(NULL))
#define RANDOM_INT(__MIN__, __MAX__) ((__MIN__) + random() % ((__MAX__+1) - (__MIN__)))
Let us know how you go
trapper is offline   Reply With Quote
 

» Advertisements
» Online Users: 469
11 members and 458 guests
Abidullah, AngryOrange, ArthurOff, Arty Tales, bignoggins, ilmman, kamrul00gg, magdaleneei61, schmallegory, Sloshmonster, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,429
Threads: 94,024
Posts: 402,577
Top Poster: BrianSlick (7,978)
Welcome to our newest member, magdaleneei61
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:36 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.