diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-06-26 16:30:32 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-06-26 16:30:32 -0300 |
commit | be63d995c102d02b7d5f3457b1cb6dc2aca7a406 (patch) | |
tree | 9b345f924ffc4e98f4b6618699163df9cfda4c96 /lmathlib.c | |
parent | 2b1fc1b38cd9a21d22ca10c5d4debc99b7fa93c9 (diff) | |
download | lua-be63d995c102d02b7d5f3457b1cb6dc2aca7a406.tar.gz lua-be63d995c102d02b7d5f3457b1cb6dc2aca7a406.tar.bz2 lua-be63d995c102d02b7d5f3457b1cb6dc2aca7a406.zip |
tiny bug: 'randomseed' was calling 'rand' (instead of 'l_rand')
to discard first value
Diffstat (limited to 'lmathlib.c')
-rw-r--r-- | lmathlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.114 2014/12/27 20:32:26 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.115 2015/03/12 14:04:04 roberto Exp roberto $ |
3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -273,7 +273,7 @@ static int math_random (lua_State *L) { | |||
273 | 273 | ||
274 | static int math_randomseed (lua_State *L) { | 274 | static int math_randomseed (lua_State *L) { |
275 | l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); | 275 | l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); |
276 | (void)rand(); /* discard first value to avoid undesirable correlations */ | 276 | (void)l_rand(); /* discard first value to avoid undesirable correlations */ |
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
279 | 279 | ||