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)
|
||||
{
|
||||
std::generate (
|
||||
std::begin (m_state),
|
||||
std::end (m_state),
|
||||
[&] (void) {
|
||||
u64 parts[2];
|
||||
seq.generate (
|
||||
std::begin (parts),
|
||||
std::end (parts)
|
||||
);
|
||||
return parts[0] << 4 | parts[1];
|
||||
}
|
||||
);
|
||||
u32 parts[8];
|
||||
seq.generate (std::begin (parts), std::end (parts));
|
||||
|
||||
for (int i = 0; i < std::ssize (m_state); ++i)
|
||||
m_state[i] = u64 (parts[i * 2]) << 32 | parts[i * 2 + 1];
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user