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 question

Author
Message
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 12th Nov 2005 14:01
hi,how do i set a rnd # between the #s i want?

example :i want a random # between -500 & 500..

??
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 12th Nov 2005 14:11
rnd(1000)-500

so if rnd=700

700-500=200

if rnd=350

350-500=-150

all you need to do is know what range you want and then add the offset from zero, so 32 to 76=

rnd(44)+32

ie

if rnd=44

44+32=76

if rnd=0

0+32=32

cheers.



if there is one thing I can NOT tolerate, it`s intolerant people.
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 12th Nov 2005 14:15
"rnd(1000)-500"

cool,thats what i came up with.guess i was right for once. thanks!

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 12th Nov 2005 14:24
no problem, being right for once happens more often the more you do btw



if there is one thing I can NOT tolerate, it`s intolerant people.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 12th Nov 2005 21:37
Quote: "cool,thats what i came up with.guess i was right for once. thanks!"


The more you program the more that'll happen.

AKA: Practice makes perfect.

Login to post a reply

Server time is: 2024-09-24 09:26:21
Your offset time is: 2024-09-24 09:26:21