why random(x) = 0..x?

Everything else that doesn't fall into one of the other PB categories.
sec
Enthusiast
Enthusiast
Posts: 792
Joined: Sat Aug 09, 2003 3:13 am
Location: 90-61-92 // EU or ASIA
Contact:

why random(x) = 0..x?

Post by sec »

why random(x) = 0..x? that isn't 0..x-1?
:idea:
random(x) for result in range 0..x-1 better 0..x:
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

I think it's great with Random(x) gives you a number between 0 and x..
That way you can get any of the numbers you give, including zero.
But that's my opinion anyways..

-Lars

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

it doesn't matter, as long as its properly docuemented: it generates a number from 0 to x (including 0 and x)... not BETWEEN those numbers

also, it generates an int, quite uncommon for a basic as far as i know :)
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

I once had a language (don't remember which one) that had two commands for random-generation, one producing integers in a range of numbers and one producing random floats between 0 and 1. I believe they were called Random and Rand (or the other way round).
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

freedimension wrote: I once had a language (don't remember which one) that had two commands for random-generation, one producing integers in a range of numbers and one producing random floats between 0 and 1. I believe they were called Random and Rand (or the other way round).
Could be Blitz you're talking about.. it uses Rnd(from,to) for floating point values, and Rand(from,to) for integer values..

-Lars

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2148
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

blueznl wrote:it doesn't matter, as long as its properly docuemented: it generates a number from 0 to x (including 0 and x)... not BETWEEN those numbers

also, it generates an int...
Noted for next doc update (v3.80)...
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply