Usualy "non-negative", not positive !
Cheers, Ched'
Le 05.04.2017 à 16:55, Bart a écrit :
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Random
"random returns a random number between 0 and abs(num-1)"
IIUC, then Random() shoud always return a positive number.
Bart
_
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Random
"random returns a random number between 0 and abs(num-1)"
IIUC, then Random() shoud always return a positive number.
Bart
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.
Fun fact: TP's random used an unsigned parameter (word), so no ambiguity there.
Random (function)
--
Returns a random number.
Declaration:
function Random [ ( Range: Word) ]: < Same type as parameter >;
Bart
___
fpc-pascal maillist
On 05/04/17 04:49, Ryan Joseph wrote:
Yeah after all this talk, I’m going to use array[0..0, 0..0, 0..0] and allocate
the memory myself to avoid overhead and confusion. Thanks for explaining
everything to me but this time going low level makes the most sense.
Then you lose the ability to turn
On 4/5/17, Santiago A. wrote:
> random(-10)
> will output numbres -9..0
That was not realy the question.
The question is wether the documentation is wrong, or the
implementation or neither.
B.t.w. Delphi7 gives me:
Random(-10) = -776108169
Random(-10) = 244426112
Random(-10) = -1774796928
Rando
Il 05/04/2017 18:09, Bart ha scritto:
http://www.freepascal.org/docs-html/current/rtl/system/random.html
"Random returns a random number larger or equal to 0 and strictly less than L"
However random(a negative number) returns a number <= 0 and > L
program r;
begin
randomize;
writeln('Ra
El 05/04/2017 a las 18:09, Bart escribió:
> http://www.freepascal.org/docs-html/current/rtl/system/random.html
>
> "Random returns a random number larger or equal to 0 and strictly less than L"
>
> However random(a negative number) returns a number <= 0 and > L
>
>
> program r;
> begin
> randomiz
http://www.freepascal.org/docs-html/current/rtl/system/random.html
"Random returns a random number larger or equal to 0 and strictly less than L"
However random(a negative number) returns a number <= 0 and > L
program r;
begin
randomize;
writeln('Random(-10) = ',Random(-10));
end.
C:\Users
One of the FPC mirrors "freepascal.stack.nl" is currently being migrated to
a new vm. I hope access will be restored within hours.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal