bg5
2015-04-02 08:29:08
RandomRange(Min,Max) gives number from Min to Max-1
e.x.
e.x.
RandomRange(2,3);
will always return 2.
2015-04-02 08:29:08
RandomRange(2,3);
will always return 2.
2015-04-02 08:33:45
From: bg5
RandomRange(Min,Max) gives number from Min to Max-1
e.x.will always return 2.
RandomRange(2,3);
2015-04-02 09:36:12
From: bg5Yeah it is not a bug, that is how it is supposed to work.. Take a look at here & here.
RandomRange(Min,Max) gives number from Min to Max-1
e.x.will always return 2.
RandomRange(2,3);
2015-04-02 10:01:17
2015-04-02 10:24:28
The collective opinion of Skype was "It should be inclusive or exclusive on both the upper and the lower bounds, not inclusive on the lower bounds and exclusive on the upper bounds."
"Making it inclusive would break lots of things"
2015-04-02 10:29:45
From: bg5
Exactly, I was thinking the same. But it should be rathere inclusive, otherwise what RandomRange(2,3) (exclusive) was supposed to return?
or would fix a lot of unintelligible errors :P
2015-04-02 15:20:53
From: 3Garrett3
Yeah I agree that inclusive on both bounds would be best. The general feeling was that it should be consistent at least because having inclusive/exclusive makes less sense intuitively.
2015-04-02 17:28:16
From: slacky
It acts the same as in FPC & Delphi.. Which is a good thing.. Else there could be confusion there, eg when people make plugins, port Delphi/FPC-code to Lape or similar stuff.
There is Random(lo,hi) which includes the upper bound..
2015-04-02 20:10:26
From: 3Garrett3
Wait, the Random(lo,hi)… is not the same as RandomRange(from, to)? Well if Random() is inclusive I'll just use that, doesn't bother me.
2015-04-03 17:25:32
From: slacky
There is Random(lo,hi) which includes the upper bound..