deferred class GEN_RAND

Features exported to INTERNALS_HANDLER

Here is the common way to use a random number generator. Current implementations are MIN_STAND, STD_RAND.

Direct parents

non-conformant parents

ANY

Known children

conformant children

MIN_STAND

Summary

exported features

Creation procedures:

No modifications:

Details

deferred make

Create the generator with an automatic hazardous setting of the seed_value. Because automatic setting may be done using internal address of Current for example, it may produces platform dependent behavior or compilation-mode dependant behavior. Also consider with_seed to chose the most appropriate.

deferred with_seed (seed_value: INTEGER)

Create the generator with an explicit seed_value.

deferred next

Compute next random number in sequence.

last_double: REAL
This feature is obsolete: Use `last_real' instead (nov 4th 2004).
deferred last_real: REAL

Look at the last computed number. Range 0 to 1

ensure

  • Result > 0 and Result <= 1

deferred last_integer (n: INTEGER): INTEGER

Look the last computed number. Range 1 to n.

require

  • n >= 1

ensure

  • 1 <= Result and Result <= n