|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Functions | |
| constexpr bool | splitmix64_gives_the_numbers_of_its_reference () noexcept |
Whether SplitMix64_Rng gives, for the seeds 0 and 1234567, the first numbers of the SplittableRandom of Java and of splitmix64.c. | |
| template<std::unsigned_integral Word, std::unsigned_integral Wide, class Next > | |
| constexpr Word | bounded_after_a_low_product (Next &next, const Word n, Wide product) noexcept(noexcept(next())) |
An integer in [0, n), each with the same probability, from numbers of the bits of Word: the method of Lemire. | |
| template<std::unsigned_integral Word, std::unsigned_integral Wide, class Next > | |
| constexpr Word | bounded (Next &&next, const Word n) noexcept(noexcept(next())) |
An integer in [0, n), each with the same probability, from numbers of the bits of Word: the method of Lemire, which bounded_after_a_low_product() describes. | |
| template<std::unsigned_integral Word, class Next > | |
| constexpr Word | masked (Next &&next, const Word n) noexcept(noexcept(next())) |
An integer in [0, n), each with the same probability, from numbers of the bits of Word, without a product of twice the bits: a number under the least mask of ones that covers n - 1, until one is below n. | |
| std::uint64_t | entropy_of_the_run () noexcept |
| A number that changes from a run of the program to another: the time, to the precision of the clock; the processor time that the program has taken; and the address of a variable of the stack, which the system may place at random. | |
| std::uint64_t | seed_of_its_own () noexcept |
| The seed of a Random_Source that is given none: the next number of a SplitMix64 of the process, which is seeded with entropy_of_the_run() when it gives the first one. | |
|
constexprnoexcept |
An integer in [0, n), each with the same probability, from numbers of the bits of Word: the method of Lemire, which bounded_after_a_low_product() describes.
| Word | The unsigned type of the numbers and of the integer. |
| Wide | An unsigned type with twice the bits of Word. |
| [in] | next | What gives the numbers, uniform in the range of Word. |
| [in] | n | The number of values. |
n is not 0. Definition at line 773 of file ah-random.H.
References Aleph::next(), and Aleph::product().
|
constexprnoexcept |
An integer in [0, n), each with the same probability, from numbers of the bits of Word: the method of Lemire.
The integer is the high word of the product of a number by n. A number whose product has its low word among the first 2^w mod n values, for words of w bits, is rejected, and another one is taken: each integer is then that of as many numbers. It divides only when the low word is below n, which bounded() leaves to this function, out of line, so that its usual draw calls nothing.
| Word | The unsigned type of the numbers and of the integer. |
| Wide | An unsigned type with twice the bits of Word. |
| [in] | next | What gives the numbers, uniform in the range of Word. |
| [in] | n | The number of values. |
| [in] | product | The product by n of the first number, whose low word is below n. |
n is not 0. Definition at line 748 of file ah-random.H.
References Aleph::next(), and Aleph::product().
|
inlinenoexcept |
A number that changes from a run of the program to another: the time, to the precision of the clock; the processor time that the program has taken; and the address of a variable of the stack, which the system may place at random.
The clocks are those of the C library: <chrono> would be included by nearly every header of Aleph, through the trees, and their units would take half as long again to compile.
Definition at line 820 of file ah-random.H.
References Aleph::SplitMix64_Rng::increment, and Aleph::SplitMix64_Rng::mix().
Referenced by seed_of_its_own(), and TEST().
|
constexprnoexcept |
An integer in [0, n), each with the same probability, from numbers of the bits of Word, without a product of twice the bits: a number under the least mask of ones that covers n - 1, until one is below n.
It keeps more than half of the numbers.
| Word | The unsigned type of the numbers and of the integer. |
| [in] | next | What gives the numbers, uniform in the range of Word. |
| [in] | n | The number of values. |
n is not 0. Definition at line 799 of file ah-random.H.
References k, and Aleph::next().
|
inlinenoexcept |
The seed of a Random_Source that is given none: the next number of a SplitMix64 of the process, which is seeded with entropy_of_the_run() when it gives the first one.
Each call takes another number, from whatever thread.
Definition at line 836 of file ah-random.H.
References entropy_of_the_run(), Aleph::SplitMix64_Rng::increment, and Aleph::SplitMix64_Rng::mix().
Referenced by Aleph::Random_Source::Random_Source(), Aleph::Random_Source::operator=(), TEST(), and TEST().
|
constexprnoexcept |
Whether SplitMix64_Rng gives, for the seeds 0 and 1234567, the first numbers of the SplittableRandom of Java and of splitmix64.c.
Definition at line 715 of file ah-random.H.
References Aleph::and.