|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
A deterministic, fully-specified random stream (SHA-256 counter mode). More...
#include <derive.hpp>
Public Member Functions | |
| DrawStream ()=default | |
| Construct unseeded; the first draw self-seeds from entropy (unseeded runs stay random). | |
| void | Reseed (std::uint64_t master, std::uint64_t domain, std::uint64_t index) |
| Rekey the stream from (master seed, domain tag, stream index) under b2rand/1 and restart its counter. | |
| std::uint64_t | Uint64 () |
| The next 8 stream bytes as a big-endian unsigned 64-bit integer. | |
| double | UnitDouble () |
| Uniform on [0,1), exactly 53 bits: (Uint64 >> 11) * 2^-53. | |
| double | SymmetricDouble () |
| Uniform on [-1,1]: 2*UnitDouble() - 1 (both operations exact). | |
| mpz_int | Bits (unsigned num_bits) |
| The next n bits as a nonnegative integer (big-endian bytes, masked). | |
| mpz_int | IntSymmetric (mpz_int const &bound) |
| Uniform integer on [-bound, bound], by rejection over Bits(bitlen(2*bound)). | |
| real_mp | UnitRealMp (unsigned digits) |
| Uniform on [0,1) at digits decimal digits: ldexp(Bits(k), -k) with k = ceil(digits*log2(10)) + 1, materialized at digits digits of precision. | |
A deterministic, fully-specified random stream (SHA-256 counter mode).
One per thread in practice (see ThreadDrawStream); reseeded by the same (master, domain, index) tuples the legacy engine seeding uses, so setup / per-path / worker domain separation is preserved.
|
default |
Construct unseeded; the first draw self-seeds from entropy (unseeded runs stay random).
Seeded runs call Reseed before any draw.
| mpz_int bertini::records::DrawStream::Bits | ( | unsigned | num_bits | ) |
The next n bits as a nonnegative integer (big-endian bytes, masked).
Uniform integer on [-bound, bound], by rejection over Bits(bitlen(2*bound)).
| void bertini::records::DrawStream::Reseed | ( | std::uint64_t | master, |
| std::uint64_t | domain, | ||
| std::uint64_t | index ) |
Rekey the stream from (master seed, domain tag, stream index) under b2rand/1 and restart its counter.
| double bertini::records::DrawStream::SymmetricDouble | ( | ) |
Uniform on [-1,1]: 2*UnitDouble() - 1 (both operations exact).
| std::uint64_t bertini::records::DrawStream::Uint64 | ( | ) |
The next 8 stream bytes as a big-endian unsigned 64-bit integer.
| double bertini::records::DrawStream::UnitDouble | ( | ) |
Uniform on [0,1), exactly 53 bits: (Uint64 >> 11) * 2^-53.
| real_mp bertini::records::DrawStream::UnitRealMp | ( | unsigned | digits | ) |
Uniform on [0,1) at digits decimal digits: ldexp(Bits(k), -k) with k = ceil(digits*log2(10)) + 1, materialized at digits digits of precision.