HP Pascal/iX Reference Manual (31502-90022)

12- 59
it.
When OVFLCHECK is OFF, integer overflows are not detected. One use for
this is in a random number generator, when overflows are expected and are
to be ignored.
NOTE This option can be used to turn off overflow for bit32
multiplication; this option has no effect on bit52 or longint
multiplication.
Example
PROGRAM t (output);
MODULE rand;
EXPORT
FUNCTION random : integer;
PROCEDURE init_random (seed,
range : integer);
IMPLEMENT
CONST
multiplier = 31415821;
VAR
rand_seed,
rand_range : integer;
PROCEDURE init_random (seed,
range : integer);
BEGIN
rand_seed := seed;
rand_range := range;
END;
FUNCTION random : integer;
BEGIN
$PUSH, OVFLCHECK OFF$
rand_seed := (rand_seed * multiplier +1) MOD rand_range;
$POP$
random := rand_seed;
END;
END;
IMPORT rand;
BEGIN
init_random(1234567,1000);
writeln(random);
writeln(random);
writeln(random);
END.
PAGE
PAGE is an HP Standard Option.
The PAGE compiler option starts a new page of the listing if the LIST
option is ON.
Syntax
$PAGE$
Default Not applicable.