fix(awesome) randomness
Close #3123, close #3124 Co-authored-by: Emmanuel Lepage Vallee <elv1313@gmail.com>
This commit is contained in:
parent
d0b9938da1
commit
b807bbae56
10
awesome.c
10
awesome.c
|
@ -84,10 +84,16 @@ init_rng(void)
|
|||
lua_getfield(L, -1, "randomseed");
|
||||
|
||||
/* Push a seed */
|
||||
lua_pushnumber(L, g_random_int() + g_random_double());
|
||||
lua_pushnumber(L, g_random_int());
|
||||
|
||||
/* Call math.randomseed */
|
||||
lua_call(L, 1, 0);
|
||||
if(lua_pcall(L, 1, 0, 0))
|
||||
{
|
||||
warn("Random number generator initialization failed: %s", lua_tostring(L, -1));
|
||||
/* Remove error function and error string */
|
||||
lua_pop(L, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remove "math" global */
|
||||
lua_pop(L, 1);
|
||||
|
|
Loading…
Reference in New Issue