Well, I waited to see if one of the designers would have answer it... you are not passing it a negative, nor is it responding with a negative. You are passing it with the high (MSR) bit on, Int32(-16) = 1000000000010000
The compiler is obviously type casting the result to Int32, showing as -9 etc. I have noticed when working with Int64, FPC is actually working as UInt64 is some of my other projects. My two cents. O. -----Original Message----- From: fpc-devel [mailto:fpc-devel-boun...@lists.freepascal.org] On Behalf Of Bart Sent: Saturday, May 20, 2017 5:00 PM To: FPC developers' list <fpc-devel@lists.freepascal.org> Subject: Re: [fpc-devel] Different results of random(int32) and random(int64) for negative limit value On 5/20/17, Jonas Maebe <jo...@freepascal.org> wrote: > 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. I already reported that the documentation is a bit "off": https://bugs.freepascal.org/view.php?id=31642 Bart _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel