Previous: QSort procedure To the Table of Content Next: Randomize procedure

- 4.62.2.65 -
Standard Units
System Unit
System Unit Procedures and Functions

Random function

Targets: MS-DOS, OS/2, Win32


System Unit

Returns a random number.

Declaration:
function Random [ ( Range: Word) ];
Remarks:
Range, if specified, results in 0 <= Result < Range. If not specified, the range is 0 <= result < 1.

A call to Randomize should be made prior to Random. This initializes the random number generator.

Example:
{$ifndef __CON__}
  This program must be compiled as console application only
{ $endif}
begin 
  Randomize;
  repeat
    Writeln(Random(65535));
  until
  KeyPressed;
end.



Previous: QSort procedure To the Table of Content Next: Randomize procedure
QSort procedure Table of Content Randomize procedure

- 4.62.2.65 -