J
James Lin
Guest
If I have a random_range(1, 5) can it return 1 or 5, or is it only 2,3, or 4?
random_range(1,5); //return antyhing between 1 and 5, including every fractions
irandom_range(1,5); //returns either 1,2,3,4 or 5
choose(1,3,5); //choose one of the argument provided
//Remember you can use variables in there too
Well, I think if you'd do:It can return 1, but unless you use irandom_range(), I don't think it will return the 5. The random(n) function will not return n, so i assume it is the same for random_range(n).
var _a = random_range(1,5);
var _b = 1;
if( _a == _ b){
//Do awesome stuff
}
Thanks! This really clears up all of the questions I had about random numbers!Neither.
Code:random_range(1,5); //return antyhing between 1 and 5, including every fractions irandom_range(1,5); //returns either 1,2,3,4 or 5 choose(1,3,5); //choose one of the argument provided //Remember you can use variables in there too
Well, I think if you'd do:
Awesome stuff wouldn't come around very often. I don't know if it would ever trigger if _b=5, tho, I will take your word for it (plus, who would do that, really?).Code:var _a = random_range(1,5); var _b = 1; if( _a == _ b){ //Do awesome stuff }
LOL. The tests for what random() and random_range() return were boring. We would run it in a loop for an hour or more just to see if it would ever return the specified values. Nobody actually trusted the manual in the olden days when they realized there were a lot of typos in it.Neither.
Code:random_range(1,5); //return antyhing between 1 and 5, including every fractions irandom_range(1,5); //returns either 1,2,3,4 or 5 choose(1,3,5); //choose one of the argument provided //Remember you can use variables in there too
Well, I think if you'd do:
Awesome stuff wouldn't come around very often. I don't know if it would ever trigger if _b=5, tho, I will take your word for it (plus, who would do that, really?).Code:var _a = random_range(1,5); var _b = 1; if( _a == _ b){ //Do awesome stuff }
Geez, does indees sounds boring as ****...LOL. The tests for what random() and random_range() return were boring. We would run it in a loop for an hour or more just to see if it would ever return the specified values. Nobody actually trusted the manual in the olden days when they realized there were a lot of typos in it.
For the sake of usefulness to others, please use a proper title when starting a thread, imagine if everybody would use titles like "Question pls answer". Everybody has a question in the programming forum that they want answered. I'm not a moderator, just had to speak my mind.If I have a random_range(1, 5) can it return 1 or 5, or is it only 2,3, or 4?