Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Rnd() command problem

Author
Message
Francesco
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: Milan, Italy
Posted: 2nd May 2004 14:23
How can I set the rnd() command to select a number from a series of them(such as 2-4-5-7)? Is it possible?

Non si inalberi mica con me, sa!
Lei è venuto qui, lei ha il tombino intasato!
Siamo uno spurgo serio, noi!
Gav_b_uk
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location: Midlands, UK
Posted: 2nd May 2004 15:13 Edited at: 2nd May 2004 15:14
You'll need to do a bit of code that will use a range of random numbers to pick a number that you want. for example:

a=rnd(300)
if a>=0 and a <100
a=2
else
if a>=100 and a<200
a=4
else
if a>=200 and a<300
a=5
endif
endif
endif


I would say that's at least one way of doing it.

Hope it helps!
NathanF
20
Years of Service
User Offline
Joined: 24th Mar 2004
Location:
Posted: 2nd May 2004 15:13 Edited at: 2nd May 2004 15:16
if you put:
rnd(10)+5
It'll give you a number between 5 and 15.
edit: Sorry, i thought you meant something else

.........what's the point of reading this?
Francesco
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: Milan, Italy
Posted: 2nd May 2004 15:44
Thanks to Gav_b_uk and Dark Sephiroth those threads really helped me.

Non si inalberi mica con me, sa!
Lei è venuto qui, lei ha il tombino intasato!
Siamo uno spurgo serio, noi!

Login to post a reply

Server time is: 2024-11-26 14:38:00
Your offset time is: 2024-11-26 14:38:00