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
|
@ -116,6 +116,8 @@ private:
|
|||
// next(self, min=0, max=32767) -> get next value
|
||||
static int l_next(lua_State *L);
|
||||
|
||||
// save state
|
||||
static int l_get_state(lua_State *L);
|
||||
public:
|
||||
LuaPseudoRandom(s32 seed) : m_pseudo(seed) {}
|
||||
|
||||
|
@ -150,6 +152,9 @@ private:
|
|||
// get next normally distributed random value
|
||||
static int l_rand_normal_dist(lua_State *L);
|
||||
|
||||
// save and restore state
|
||||
static int l_get_state(lua_State *L);
|
||||
static int l_set_state(lua_State *L);
|
||||
public:
|
||||
LuaPcgRandom(u64 seed) : m_rnd(seed) {}
|
||||
LuaPcgRandom(u64 seed, u64 seq) : m_rnd(seed, seq) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue