Bitcoin Core  27.99.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

static uint256 GetUintFromEnv (const std::string &env_name)
 Return the unsigned from the environment var if available, otherwise 0. More...
 
void Seed (FastRandomContext &ctx)
 Seed the given random ctx or use the seed passed in via an environment var. More...
 

Variables

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

Function Documentation

◆ GetUintFromEnv()

static uint256 GetUintFromEnv ( const std::string &  env_name)
static

Return the unsigned from the environment var if available, otherwise 0.

Definition at line 17 of file random.cpp.

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

◆ Seed()

void Seed ( FastRandomContext ctx)

Seed the given random ctx or use the seed passed in via an environment var.

Definition at line 24 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, the global could be made thread_local (given that thread_local is supported on all architectures we support) or a per-thread instance could be used in the multi-threaded test.

Definition at line 14 of file random.cpp.