[fpc-devel] Different results of random(int32) and random(int64) for negative limit value
José Mejuto
joshyfun at gmail.com
Sat May 20 15:38:48 CEST 2017
El 20/05/2017 a las 14:57, Jonas Maebe escribió:
> On 20/05/17 14:36, Martin Schreiber wrote:
>> Is this intended? If not, which one is correct?
>
> random(x) is undefined for negative parameters. It should have had an
> unsigned parameter, like in Turbo Pascal (where it is word). Delphi
> defines it as always returning a positive value, but I don't know what
> happens if you pass a negative parameter there.
Hello,
At least in 3.0 (trunk not tested as I don't have it compiled) the first
and second random numbers are always the same value, so:
Randomize;
A:=Random(n);
B:=Random(n);
A and B will be always the same value.
Can someone with trunk test it ?
--
More information about the fpc-devel
mailing list