lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> This is probably a bug in Lua, since srand should accept unsigned ints.

This seems to fix it:

static int math_randomseed (lua_State *L) {
  srand(luaL_checknumber(L, 1));
  return 0;
}

The original code used luaL_checkint instead of luaL_checknumber.