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 03-18-2009, 12:24 AM   #8 (permalink)
DenVog
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 624
DenVog is on a distinguished road
Default

Quote:
Originally Posted by roberthuttinger View Post
what about a range between numbers? I cant find this. in php it would be something like rand(10,20);. Now I need to get a number in specific ranges based on user input.

added note: i guess I could do 1 + arc4random() %10 + 10 for a number 11 - 20 but there hs to be a more elegant way.
tia!
rob
How could this be modified to deliver a range between a negative and positive number? Right now I'm using
Code:
int endX = round(random() % 320);
to get a random number between 0 and 320. I'd like to get a range between -40 and +360, for example.
DenVog is offline   Reply With Quote
 

» Advertisements
» Online Users: 467
19 members and 448 guests
apatsufas, baja_yu, buggen, chenpo, ChrisYates, Feldspar, HowEver, ilmman, IphoneSdk, jbro, jeroenkeij, jNoxx, RobTaku, rraagg, samdanielblr, swelsh, taylor202, Trickphotostudios, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,636
Threads: 94,098
Posts: 402,804
Top Poster: BrianSlick (7,990)
Welcome to our newest member, samdanielblr
Powered by vBadvanced CMPS v3.1.0

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