[fpc-pascal] Re: random numbers negative

Lukasz Sokol el.es.cr at gmail.com
Wed Aug 17 09:54:00 CEST 2011


On 16/08/2011 16:25, Luis Fernando Del Aguila Mejía wrote:
> I have a doubt.
> With the random function, Can you generate random numbers negative?
> 
> Begin
> randomize;
> Writeln (random (-127)) / / 0> = n> -127
> End.
> 
> thanks.

As only negative range :

somebody (Felipe) wrote that: ( -1*Random(127) );

As a range of -127...127:

Random(255) - 127;

L.




More information about the fpc-pascal mailing list