Page 1 of 1

why random(x) = 0..x?

Posted: Fri Oct 03, 2003 4:03 am
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:

Posted: Fri Oct 03, 2003 10:23 am
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

Posted: Fri Oct 03, 2003 11:58 am
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 :)

Posted: Fri Oct 03, 2003 3:16 pm
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).

Posted: Fri Oct 03, 2003 6:46 pm
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

Posted: Fri Oct 03, 2003 9:49 pm
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)...