home
wiki
classes/clusters list
class information
+
Point of view
All features
ANY
INTERNALS_HANDLER
All features
class PRESS_RANDOM_NUMBER_GENERATOR
Summary
top
Press' standard generator, which uses the
MINIMAL_RANDOM_NUMBER_GENERATOR
and then uses shuffling to break up short order corelations.
Direct parents
inherit list:
MINIMAL_RANDOM_NUMBER_GENERATOR
insert list:
MINIMAL_RANDOM_NUMBER_GENERATOR
Class invariant
top
good_seed:
seed > 0 and seed < im
Overview
top
creation features
with_seed
(seed_value:
INTEGER_32
)
Create (or reset) the random number generator with an explicit
seed_value
.
make
Create (or reset) the random number generator with an automatic hazardous setting of the
seed_value
based on the CPU clock.
features
iv
:
ARRAY
[
INTEGER_32
]
ntab
:
INTEGER_32
iy
:
INTEGER_32
with_seed
(seed_value:
INTEGER_32
)
Create (or reset) the random number generator with an explicit
seed_value
.
next
Prepare the next random number in sequence.
last_integer
(n:
INTEGER_32
):
INTEGER_32
The last computed number in range 1 to
n
(see ensure).
last_real
:
REAL_64
The last computed number in range 0.0 to 1.0 excluded (see ensure).
im
:
INTEGER_32
ia
:
INTEGER_32
iq
:
INTEGER_32
ir
:
INTEGER_32
seed
:
INTEGER_32
make
Create (or reset) the random number generator with an automatic hazardous setting of the
seed_value
based on the CPU clock.
clock_based_random_seed
:
INTEGER_32
Some positive random value to be used as a seed which may change as much as possible in a random way.
iv
:
ARRAY
[
INTEGER_32
]
writable attribute
top
ntab
:
INTEGER_32
constant attribute
top
iy
:
INTEGER_32
writable attribute
top
with_seed
(seed_value:
INTEGER_32
)
effective procedure
top
Create (or reset) the random number generator with an explicit
seed_value
.
By using and explicit
seed_value
, one can replay more than once the very same hasardous sequence.
See also
make
.
require
valid_seed:
seed_value > 0 and seed_value < im
next
effective procedure
top
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
top
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
ensure
1 <= Result and Result <= n
last_real
:
REAL_64
effective function
top
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
im
:
INTEGER_32
constant attribute
top
ia
:
INTEGER_32
constant attribute
top
iq
:
INTEGER_32
constant attribute
top
ir
:
INTEGER_32
constant attribute
top
seed
:
INTEGER_32
writable attribute
top
make
effective procedure
top
Create (or reset) the random number generator with an automatic hazardous setting of the
seed_value
based on the CPU clock.
See also
with_seed
.
clock_based_random_seed
:
INTEGER_32
effective function
top
Some positive random value to be used as a seed which may change as much as possible in a random way.
ensure
Result > 0