[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4 random number generator
- From: Albert Chan <albertmcchan@...>
- Date: Mon, 26 Mar 2018 17:08:00 -0400
On Mar 26, 2018, at 3:43 PM, Coda Highland <chighland@gmail.com> wrote:
>> On Mon, Mar 26, 2018 at 12:01 PM, albertmcchan <albertmcchan@yahoo.com> wrote:
>> function last128()
>> for i=1,128 do io.write(math.random(0) & 1) end
>> end
>>
>> If what you are saying is true, period of last128() is also 2^128 - 1, all unique.
>>
>> Each last128() map 1-to-1 to 2^128 - 1 internal states.
>>
>> one last128() pattern will never occurs. (all zeroes ?)
>
> Not "all unique" because the output of the PRNG isn't 128 bits -- by
> the pigeonhole principle, some of the function outputs will be
> duplicated along the way, but importantly the SEQUENCE of those
> outputs will NOT be repeated.
I did not say output of the PRNG (only 64 bits) is all unique.
I said returns of last128() are all unique, with period 2^128 - 1
Using pigeonhole principle, 2^128-1 last128() are ALL unique
- 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
- Re: Lua 5.4 random number generator, albertmcchan
- Re: Lua 5.4 random number generator, Coda Highland
- Re: Lua 5.4 random number generator, albertmcchan
- Re: Lua 5.4 random number generator, Coda Highland