- 4.67.2.65. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.65. Random function
4.67.2.65. 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.
- 4.67.2.65. -