math.randomseed() is completely broken on Lua 5.1.5 on Mac os x
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: math.randomseed() is completely broken on Lua 5.1.5 on Mac os x
- From: Marek Majkowski <marek@...>
- Date: 2013年9月10日 12:53:48 +0100
There is a serious issue with initializing the random seed on 5.1.5 on
mac os x 10.7.5. Code:
for i = 1, 10000 do
math.randomseed(i)
print(math.random(1,2))
end
On normal Lua (tested 5.2.2) it yields decent distribution:
$ ./lua-5.2.2/src/lua math.lua |sort|uniq -c
5002 1
4998 2
But on 5.1.5 on osx it's completely broken:
$ ./lua-5.1.5/src/lua math.lua |sort|uniq -c
10000 1
I'm aware that randomseed is depending on underlying C library and
"no guarantees can be given for its statistical properties", but come
on!
Cheers
Marek Majkowski