Math.randomseed() argument [SOLVED]

os.clock() returns not an integer, but a fractional. math.randomseed()receives an integer as input

https://www.lua.org/source/5.1/lmathlib.c.html
static int math_randomseed (lua_State *L) {
  srand(luaL_checkint(L, 1));
  return 0;
}

There is also one cool post about initializing the random number generator: Big List of Defold Pro Tips! - #100 by sergey.lerg

2 Likes