diff options
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -593,8 +593,8 @@ static int math_random (lua_State *L) { | |||
593 | /* random integer in the interval [low, up] */ | 593 | /* random integer in the interval [low, up] */ |
594 | luaL_argcheck(L, low <= up, 1, "interval is empty"); | 594 | luaL_argcheck(L, low <= up, 1, "interval is empty"); |
595 | /* project random integer into the interval [0, up - low] */ | 595 | /* project random integer into the interval [0, up - low] */ |
596 | p = project(I2UInt(rv), (lua_Unsigned)up - (lua_Unsigned)low, state); | 596 | p = project(I2UInt(rv), l_castS2U(up) - l_castS2U(low), state); |
597 | lua_pushinteger(L, l_castU2S(p) + low); | 597 | lua_pushinteger(L, l_castU2S(p + l_castS2U(low))); |
598 | return 1; | 598 | return 1; |
599 | } | 599 | } |
600 | 600 | ||