21 constexpr auto RANDOM_CTX_SEED{
"RANDOM_CTX_SEED"};
27 static const uint256 ctx_seed = []() {
29 if (
const char* num{std::getenv(RANDOM_CTX_SEED)}) {
33 std::cerr << RANDOM_CTX_SEED <<
" must consist of up to " <<
uint256::size() * 2 <<
" hex digits (\"0x\" prefix allowed), it was set to: '" << num <<
"'.\n";
46 LogInfo(
"Setting random seed for current tests to %s=%s\n", RANDOM_CTX_SEED, seed.GetHex());
#define Assert(val)
Identity function.
static constexpr unsigned int size()
static std::optional< uint256 > FromUserHex(std::string_view str)
static const uint256 ZERO
void MakeRandDeterministicDANGEROUS(const uint256 &seed) noexcept
Internal function to set g_determinstic_rng.
uint256 GetRandHash() noexcept
Generate a random uint256.
std::atomic< bool > g_seeded_g_prng_zero
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
@ ZEROS
Seed with a compile time constant of zeros.
@ FIXED_SEED
Seed with a fixed value that never changes over the lifetime of this process.