|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Knuth's random number generator, from his rng.c (The Art of Computer Programming, Volume 2, Section 3.6), which ran_array.c compiles into Aleph.
More...
Go to the source code of this file.
Macros | |
| #define | ALEPH_RAN_ARRAY_DEPRECATED [[deprecated("ran_array.h goes in 8.0.0; use the engines of <random> instead")]] |
| #define | ran_arr_next() (*ran_arr_ptr >=0 ? *ran_arr_ptr++ : ran_arr_cycle()) |
| The next random number. | |
Functions | |
| void | ran_start (long seed) |
Starts the generator with seed: do this before using it. | |
| long | ran_arr_cycle (void) |
Makes a new batch of numbers and returns its first one: ran_arr_next() calls it when the batch runs out. | |
Variables | |
| long * | ran_arr_ptr |
| Points to the next number of the batch, or to -1 when the batch has run out. | |
Knuth's random number generator, from his rng.c (The Art of Computer Programming, Volume 2, Section 3.6), which ran_array.c compiles into Aleph.
After ran_start(seed), ran_arr_next() gives the numbers, in [0, 2^30).
ran_array.h and ran_array.c go in 8.0.0. Use the engines of <random> instead. Definition in file ran_array.h.
| #define ALEPH_RAN_ARRAY_DEPRECATED [[deprecated("ran_array.h goes in 8.0.0; use the engines of <random> instead")]] |
Definition at line 68 of file ran_array.h.
| #define ran_arr_next | ( | ) | (*ran_arr_ptr >=0 ? *ran_arr_ptr++ : ran_arr_cycle()) |
The next random number.
ran_array.h goes in 8.0.0. Definition at line 99 of file ran_array.h.
|
extern |
Makes a new batch of numbers and returns its first one: ran_arr_next() calls it when the batch runs out.
Without ran_start(), it first starts the generator as ran_start(314159).
ran_array.h goes in 8.0.0. Definition at line 97 of file ran_array.c.
References QUALITY, ran_arr_buf, ran_arr_dummy, ran_arr_ptr, ran_array(), and ran_start().
|
extern |
Starts the generator with seed: do this before using it.
ran_array.h goes in 8.0.0. Definition at line 66 of file ran_array.c.
References is_odd, KK, LL, MM, mod_diff, ran_arr_ptr, ran_arr_started, ran_array(), ran_x, seed, and TT.
Referenced by ran_arr_cycle(), TEST(), and TEST().
|
extern |
Points to the next number of the batch, or to -1 when the batch has run out.
ran_array.h goes in 8.0.0. Definition at line 58 of file ran_array.c.
Referenced by ran_arr_cycle(), and ran_start().