GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
MINIMAL_RANDOM_NUMBER_GENERATOR
+
Point of view
INTERNALS_HANDLER
ANY
INTERNALS_HANDLER
TYPED_INTERNALS
All features
class MINIMAL_RANDOM_NUMBER_GENERATOR
Summary
top
Implements the Minimal Standard generator from Press et. al. Numerical Recipes.
Direct parents
Inherit list:
RANDOM_NUMBER_GENERATOR
Known children
Inherit list:
PRESS_RANDOM_NUMBER_GENERATOR
Insert list:
PRESS_RANDOM_NUMBER_GENERATOR
Overview
top
Creation features
make
Create (or reset) the random number generator with an automatic hazardous setting of the
seed_value
based on the CPU clock.
with_seed
(seed_value:
INTEGER_32
)
Create (or reset) the random number generator with an explicit
seed_value
.
Exported features
make
Create (or reset) the random number generator with an automatic hazardous setting of the
seed_value
based on the CPU clock.
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_real
:
REAL_64
The last computed number in range 0.0 to 1.0 excluded (see ensure).
last_integer
(n:
INTEGER_32
):
INTEGER_32
The last computed number in range 1 to
n
(see ensure).
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
.
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 hazardous sequence.
See also
make
.
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_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
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