mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-30 09:40:16 +02:00
random: simplify FastRandomContext::randbytes using fillrand
This commit is contained in:
parent
3da636e08b
commit
44c11769a8
@ -593,11 +593,8 @@ uint256 FastRandomContext::rand256() noexcept
|
|||||||
template <typename B>
|
template <typename B>
|
||||||
std::vector<B> FastRandomContext::randbytes(size_t len)
|
std::vector<B> FastRandomContext::randbytes(size_t len)
|
||||||
{
|
{
|
||||||
if (requires_seed) RandomSeed();
|
|
||||||
std::vector<B> ret(len);
|
std::vector<B> ret(len);
|
||||||
if (len > 0) {
|
fillrand(MakeWritableByteSpan(ret));
|
||||||
rng.Keystream(MakeWritableByteSpan(ret));
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
template std::vector<unsigned char> FastRandomContext::randbytes(size_t);
|
template std::vector<unsigned char> FastRandomContext::randbytes(size_t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user