Bitcoin Core 28.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
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.
 
void SeedRandomForTest (SeedRand seedtype)
 Seed the RNG for testing.
 

Variables

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

Function Documentation

◆ MakeRandDeterministicDANGEROUS()

void MakeRandDeterministicDANGEROUS ( const uint256 & seed)
externnoexcept

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.