Add various insecure_rand wrappers for tests

This commit is contained in:
Pieter Wuille 2017-05-23 15:00:46 -07:00
parent 124d13a58c
commit 1119927df0

View file

@ -28,10 +28,12 @@ static inline void seed_insecure_rand(bool fDeterministic = false)
insecure_rand_ctx = FastRandomContext(insecure_rand_seed); insecure_rand_ctx = FastRandomContext(insecure_rand_seed);
} }
static inline uint32_t insecure_rand(void) static inline uint32_t insecure_rand() { return insecure_rand_ctx.rand32(); }
{ static inline uint256 insecure_rand256() { return insecure_rand_ctx.rand256(); }
return insecure_rand_ctx.rand32(); static inline uint64_t insecure_randbits(int bits) { return insecure_rand_ctx.randbits(bits); }
} static inline uint64_t insecure_randrange(uint64_t range) { return insecure_rand_ctx.randrange(range); }
static inline bool insecure_randbool() { return insecure_rand_ctx.randbool(); }
static inline std::vector<unsigned char> insecure_randbytes(size_t len) { return insecure_rand_ctx.randbytes(len); }
/** Basic testing setup. /** Basic testing setup.
* This just configures logging and chain parameters. * This just configures logging and chain parameters.