Bitcoin Core  28.1.0
P2P Digital Currency
Functions | Variables
random.cpp File Reference
#include <test/util/random.h>
#include <logging.h>
#include <uint256.h>
#include <cstdlib>
#include <string>
Include dependency graph for random.cpp:

Go to the source code of this file.

Functions

void MakeRandDeterministicDANGEROUS (const uint256 &seed) noexcept
 Internal function to set g_determinstic_rng. More...
 
void SeedRandomForTest (SeedRand seedtype)
 Seed the RNG for testing. More...
 

Variables

FastRandomContext g_insecure_rand_ctx
 This global and the helpers that use it are not thread-safe. More...
 

Function Documentation

◆ MakeRandDeterministicDANGEROUS()

void MakeRandDeterministicDANGEROUS ( const uint256 seed)
noexcept

Internal function to set g_determinstic_rng.

Only accessed from tests.

Definition at line 670 of file random.cpp.

Here is the caller graph for this function:

◆ SeedRandomForTest()

void SeedRandomForTest ( SeedRand  seed = SeedRand::SEED)

Seed the RNG for testing.

This affects all randomness, except GetStrongRandBytes().

Definition at line 18 of file random.cpp.

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

Variable Documentation

◆ g_insecure_rand_ctx

FastRandomContext g_insecure_rand_ctx

This global and the helpers that use it are not thread-safe.

If thread-safety is needed, a per-thread instance could be used in the multi-threaded test.

Definition at line 14 of file random.cpp.