aboutsummaryrefslogtreecommitdiff
path: root/lmathlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2007-03-27 09:37:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2007-03-27 09:37:00 -0300
commit8e36e1fe4928c60a09573a850e6807d922a56664 (patch)
tree21f48eed170de4d437629ba8818552725bfae849 /lmathlib.c
parent97505caa64aa82aab635f7135aaba8b5ef857e52 (diff)
downloadlua-8e36e1fe4928c60a09573a850e6807d922a56664.tar.gz
lua-8e36e1fe4928c60a09573a850e6807d922a56664.tar.bz2
lua-8e36e1fe4928c60a09573a850e6807d922a56664.zip
details (randomseed calls rand once to dischard first value)
Diffstat (limited to 'lmathlib.c')
-rw-r--r--lmathlib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lmathlib.c b/lmathlib.c
index 23b245e6..3d920715 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.67 2005/08/26 17:36:32 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.68 2006/08/07 19:01:56 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*/
@@ -211,6 +211,7 @@ static int math_random (lua_State *L) {
211 211
212static int math_randomseed (lua_State *L) { 212static int math_randomseed (lua_State *L) {
213 srand(luaL_checkint(L, 1)); 213 srand(luaL_checkint(L, 1));
214 (void)rand(); /* discard first value to avoid undesirable correlations */
214 return 0; 215 return 0;
215} 216}
216 217