[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4 random number generator
- From: albertmcchan <albertmcchan@...>
- Date: Mon, 26 Mar 2018 10:37:40 -0400
On Mar 23, 2018, at 6:31 PM, Coda Highland <chighland@gmail.com> wrote:
> On Fri, Mar 23, 2018 at 5:24 PM, Albert Chan <albertmcchan@yahoo.com> wrote:
>> You mean just two math.random(0) (128 bits) can predict the next one ?
>
> No, if you see the least significant bit of 128 consecutive calls to
> math.random, then you can predict the least significant bit of every
> call from there on out.
>
I tried print out 128 last bits (128 math.random calls), but I do not
see the pattern. How does the prediction work ?
You can try it on lua 5.4.0-work1
function last128()
for i=1,128 do io.write(math.random(0) & 1) end
end
- References:
- Lua 5.4 random number generator, Gé Weijers
- Re: Lua 5.4 random number generator, Roberto Ierusalimschy
- Re: Lua 5.4 random number generator, Gé Weijers
- Re: Lua 5.4 random number generator, Roberto Ierusalimschy
- Re: Lua 5.4 random number generator, Gé Weijers
- Re: Lua 5.4 random number generator, Roberto Ierusalimschy
- Re: Lua 5.4 random number generator, albertmcchan
- Re: Lua 5.4 random number generator, Gé Weijers
- Re: Lua 5.4 random number generator, Albert Chan
- Re: Lua 5.4 random number generator, Coda Highland