Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/setup_common.h
Show All 38 Lines | |||||
/** | /** | ||||
* This global and the helpers that use it are not thread-safe. | * 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 | * 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 | * that thread_local is supported on all architectures we support) or a | ||||
* per-thread instance could be used in the multi-threaded test. | * per-thread instance could be used in the multi-threaded test. | ||||
*/ | */ | ||||
extern FastRandomContext g_insecure_rand_ctx; | thread_local extern FastRandomContext g_insecure_rand_ctx; | ||||
/** | /** | ||||
* Flag to make GetRand in random.h return the same number | * Flag to make GetRand in random.h return the same number | ||||
*/ | */ | ||||
extern bool g_mock_deterministic_tests; | extern bool g_mock_deterministic_tests; | ||||
static inline void SeedInsecureRand(bool deterministic = false) { | static inline void SeedInsecureRand(bool deterministic = false) { | ||||
g_insecure_rand_ctx = FastRandomContext(deterministic); | g_insecure_rand_ctx = FastRandomContext(deterministic); | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |