lua-users home
lua-l archive

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


> The Lua reference documentation for math.randomseed() (5.3 and 5.4) makes no mention of the value range for the random seed value(s). I just helped debug an app where they were feeding it a float between 0 and 1, which didn’t work since (apparently) it needs an integer value (though I’ve no idea how it would handle, for example, a negative integer value).
>
> Might be useful to add a sentence to the Lua reference noting the expected value range?

Indeed, math.randomseed expects an integer. Negative integers are
converted to unsigned. Here is the code:

  l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1));

Thanks for the report.