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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-10-2009, 12:09 PM   #2 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
Default

Do you mean you want to create a number by adding two random numbers?

Code:
int randomA = arc4random() % 6;
int randomB = arc4random() % 6;

int weightedRandom = randomA + randomB;
Or you want to create a string that looks like "3 + 2" , but the numbers are random?

Code:
int randomA = arc4random() % 6;
int randomB = arc4random() % 6;

NSString *mathQuestion = [NSString stringWithFormat: @"%d + %d", randomA, randomB]; 
//I forgot the asterisk in that last line. I'm adding it now.
__________________

Free Games!

Last edited by smasher; 06-11-2009 at 02:09 AM.
smasher is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,840
Threads: 89,210
Posts: 380,649
Top Poster: BrianSlick (7,129)
Welcome to our newest member, saralo56
Powered by vBadvanced CMPS v3.1.0

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