Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Giuliano Colla
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;

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Bart
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

[fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Bart
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.

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Bart
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

[fpc-pascal] mirror freepascal.stack.nl down

2017-04-05 Thread Marco van de Voort
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

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread 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

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Santiago A.
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 >

Re: [fpc-pascal] Array clearing

2017-04-05 Thread Jonas Maebe
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

Re: [fpc-pascal] Bug in documentation for Random?

2017-04-05 Thread Ched
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