+
Point of view
All features
class PRESS_RANDOM_NUMBER_GENERATOR
Summary
Press' standard generator, which uses the MINIMAL_RANDOM_NUMBER_GENERATOR and then uses shuffling to break up short order correlations.
Direct parents
Inherit list: MINIMAL_RANDOM_NUMBER_GENERATOR
Insert list: MINIMAL_RANDOM_NUMBER_GENERATOR
Class invariant
Overview
Creation features
{ANY}
  • with_seed (seed_value: INTEGER_32)
    Create (or reset) the random number generator with an explicit seed_value.
{ANY}
  • make
    Create (or reset) the random number generator with an automatic randomised setting of the seed_value based on the CPU clock.
Features
{}
{ANY}
{}
{ANY}
  • make
    Create (or reset) the random number generator with an automatic randomised setting of the seed_value based on the CPU clock.
{}
writable attribute
{}
ntab: INTEGER_32
is 32
constant attribute
{}
writable attribute
{}
with_seed (seed_value: INTEGER_32)
effective procedure
{ANY}
Create (or reset) the random number generator with an explicit seed_value.
By using an explicit seed_value, one can replay the very same random sequense more than once
See also make.
require
    • valid_seed: seed_value > 0 and seed_value < im
    • valid_seed: seed_value > 0 and seed_value < im
next
effective procedure
{ANY}
Prepare the next random number in sequence.
Change internal memory of Current in order to prepare the next random number in sequence.
See also last_real, last_integer.
last_integer (n: INTEGER_32): INTEGER_32
effective function
{ANY}
The last computed number in range 1 to n(see ensure).
Internal memory is not changed and two calls will give the same Result. Use next to get a new random last_integer value.
See also last_real.
require
    • n >= 1
    • n >= 1
ensure
  • 1 <= Result and Result <= n
last_real: REAL_64
effective function
{ANY}
The last computed number in range 0.0 to 1.0 excluded (see ensure).
Internal memory is not changed and two calls will give the same Result. Use next to get a new random last_real value.
See also last_integer.
ensure
  • Result > 0 and Result <= 1
is 2147483647
constant attribute
{}
is 16807
constant attribute
{}
is 127773
constant attribute
{}
is 2836
constant attribute
{}
seed: INTEGER_32
writable attribute
{}
make
effective procedure
{ANY}
Create (or reset) the random number generator with an automatic randomised setting of the seed_value based on the CPU clock.
See also with_seed.
clock_based_random_seed: INTEGER_32
effective function
{}
Some positive random value to be used as a seed which may change as much as possible in a random way.
ensure
  • Result > 0