rand/xoshiro: simplify state initialisation from seed_seq
This commit is contained in:
parent
7185af7961
commit
82d3c36ebd
@ -39,18 +39,11 @@ xoshiro256plusplus::xoshiro256plusplus (u64 _seed)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
xoshiro256plusplus::xoshiro256plusplus (std::seed_seq &seq)
|
xoshiro256plusplus::xoshiro256plusplus (std::seed_seq &seq)
|
||||||
{
|
{
|
||||||
std::generate (
|
u32 parts[8];
|
||||||
std::begin (m_state),
|
seq.generate (std::begin (parts), std::end (parts));
|
||||||
std::end (m_state),
|
|
||||||
[&] (void) {
|
for (int i = 0; i < std::ssize (m_state); ++i)
|
||||||
u64 parts[2];
|
m_state[i] = u64 (parts[i * 2]) << 32 | parts[i * 2 + 1];
|
||||||
seq.generate (
|
|
||||||
std::begin (parts),
|
|
||||||
std::end (parts)
|
|
||||||
);
|
|
||||||
return parts[0] << 4 | parts[1];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user