Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.h
Show All 16 Lines | |||||
* Version of Boost::test prior to 1.64 have issues when dealing with nullptr_t. | * Version of Boost::test prior to 1.64 have issues when dealing with nullptr_t. | ||||
* In order to work around this, we ensure that the null pointers are typed in a | * In order to work around this, we ensure that the null pointers are typed in a | ||||
* way that Boost will like better. | * way that Boost will like better. | ||||
* | * | ||||
* TODO: Use nullptr directly once the minimum version of boost is 1.64 or more. | * TODO: Use nullptr directly once the minimum version of boost is 1.64 or more. | ||||
*/ | */ | ||||
#define NULLPTR(T) static_cast<T *>(nullptr) | #define NULLPTR(T) static_cast<T *>(nullptr) | ||||
extern uint256 insecure_rand_seed; | |||||
extern FastRandomContext insecure_rand_ctx; | extern FastRandomContext insecure_rand_ctx; | ||||
static inline void SeedInsecureRand(bool fDeterministic = false) { | static inline void SeedInsecureRand(bool deterministic = false) { | ||||
if (fDeterministic) { | insecure_rand_ctx = FastRandomContext(deterministic); | ||||
insecure_rand_seed = uint256(); | |||||
} else { | |||||
insecure_rand_seed = GetRandHash(); | |||||
} | |||||
insecure_rand_ctx = FastRandomContext(insecure_rand_seed); | |||||
} | } | ||||
static inline uint32_t insecure_rand() { | static inline uint32_t insecure_rand() { | ||||
return insecure_rand_ctx.rand32(); | return insecure_rand_ctx.rand32(); | ||||
} | } | ||||
static inline uint256 InsecureRand256() { | static inline uint256 InsecureRand256() { | ||||
return insecure_rand_ctx.rand256(); | return insecure_rand_ctx.rand256(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |