mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add API for restoring PseudoRandom and PcgRandom state (#14123)
This commit is contained in:
parent
8093044f07
commit
ceaa7e2fb0
9 changed files with 155 additions and 29 deletions
|
@ -152,6 +152,18 @@ s32 PcgRandom::randNormalDist(s32 min, s32 max, int num_trials)
|
|||
return myround((float)accum / num_trials);
|
||||
}
|
||||
|
||||
void PcgRandom::getState(u64 state[2]) const
|
||||
{
|
||||
state[0] = m_state;
|
||||
state[1] = m_inc;
|
||||
}
|
||||
|
||||
void PcgRandom::setState(const u64 state[2])
|
||||
{
|
||||
m_state = state[0];
|
||||
m_inc = state[1];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float noise2d(int x, int y, s32 seed)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue