Bitcoin Core 28.99.0
P2P Digital Currency
Enumerations | Functions | Variables
random.h File Reference
#include <consensus/amount.h>
#include <random.h>
#include <uint256.h>
#include <atomic>
#include <cstdint>
Include dependency graph for random.h:

Go to the source code of this file.

Enumerations

enum class  SeedRand { ZEROS , FIXED_SEED }
 

Functions

void SeedRandomStateForTest (SeedRand seed)
 Seed the global RNG state for testing and log the seed value. More...
 
template<RandomNumberGenerator Rng>
CAmount RandMoney (Rng &&rng)
 

Variables

std::atomic< bool > g_seeded_g_prng_zero
 
std::atomic< bool > g_used_g_prng
 

Enumeration Type Documentation

◆ SeedRand

enum class SeedRand
strong
Enumerator
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.

The seed is read from the RANDOM_CTX_SEED environment variable if set, otherwise generated randomly once, saved, and reused.

Definition at line 15 of file random.h.

Function Documentation

◆ RandMoney()

template<RandomNumberGenerator Rng>
CAmount RandMoney ( Rng &&  rng)
inline

Definition at line 35 of file random.h.

Here is the caller graph for this function:

◆ SeedRandomStateForTest()

void SeedRandomStateForTest ( SeedRand  seed)

Seed the global RNG state for testing and log the seed value.

This affects all randomness, except GetStrongRandBytes().

Definition at line 19 of file random.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_seeded_g_prng_zero

std::atomic<bool> g_seeded_g_prng_zero
extern

Definition at line 15 of file random.cpp.

◆ g_used_g_prng

std::atomic<bool> g_used_g_prng
extern

Definition at line 674 of file random.cpp.