lua-users home
lua-l archive

Re: 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]


> 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 can confirm that, also what's weird:
-- math.lua
for i = 1, 10000 do
 math.randomseed(i)
 math.random(1,2)
 print(math.random(1,2))
end
$ lua math.lua |sort|uniq -c
5002 1
4998 2
LuaJIT does not exhibit that problem.

AltStyle によって変換されたページ (->オリジナル) /