From fb4695be0ab380b3c53ea8f5f64b0cc4beacd2a1 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 13 Jan 2015 18:44:26 +0100 Subject: Made all compile for Lua 5.3 (nw) --- 3rdparty/lua/src/lmathlib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '3rdparty/lua/src/lmathlib.c') diff --git a/3rdparty/lua/src/lmathlib.c b/3rdparty/lua/src/lmathlib.c index 002c508bc46..f528f05d9f6 100644 --- a/3rdparty/lua/src/lmathlib.c +++ b/3rdparty/lua/src/lmathlib.c @@ -240,7 +240,7 @@ static int math_max (lua_State *L) { */ static int math_random (lua_State *L) { lua_Integer low, up; - double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); + double r = (double)(1.0 * l_rand()) * (1.0 / ((double)L_RANDMAX + 1.0)); switch (lua_gettop(L)) { /* check number of arguments */ case 0: { /* no arguments */ lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ @@ -269,7 +269,8 @@ static int math_random (lua_State *L) { static int math_randomseed (lua_State *L) { - l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); + lua_Number seed = (lua_Number)luaL_checknumber(L, 1); + l_srand((unsigned int)seed); (void)rand(); /* discard first value to avoid undesirable correlations */ return 0; } -- cgit v1.2.3-70-g09d2