lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Mar 24, 2018 at 2:25 PM, Albert Chan <albertmcchan@yahoo.com> wrote:
>
>> On Mar 23, 2018, at 6:31 PM, Coda Highland <chighland@gmail.com> wrote:
>>
>> The lower-order bits are less random than the higher-order bits, and
>> this is true of many RNG designs. If you want a coin flip, pick a bit
>> out of the middle instead of taking the lowest bit. If you want to
>> construct a floating-point value, the lowest two bits have enough of a
>> correlation that you get especially bad results.
>>
>> /s/ Adam
>>
>
> Do you mean top bits is not as good as the middle bits ?

In some RNGs the bottom bits are weak. In some RNGs the top bits are
weak. The middle is usually safe, so if you don't know the behavior of
the RNG in advance then you should either pull bits out of the middle
or combine bits from both ends. (Obviously if you DO know the RNG's
behavior, pick out what's good.)

/s/ Adam