Il giorno domenica 29 ottobre 2017 17:49:39 UTC+1, T L ha scritto:
>
>
>
> On Sunday, October 29, 2017 at 3:47:43 AM UTC-4, Sokolov Yura wrote:
>>
>> Why no one writes Go's version they've tested with?
>>
>> HEAD of master branch is uniform?
>>
>
> 1.9.2 is a little unfair. Tip is fair. 
>

Let me recap what happened.

At some point during the 1.9 cycle, fastrandn() was changed to use a 
multiplication+shift for doing a reduction, which is much faster and has 
introduces zero bias compared to a modulus which is much slower and 
potentially adds a little bias. 

Unfortunately, the underlying generator used by fastrand (a LFSR) was very 
weak and had a lot of bias in the high bits. Low bits were "acceptable" so 
using modulus was kind of acceptable in fastrandn(), and select was "fair 
enough". After switching to multiplication, select became were unfair. 
After this was reported, the generator was changed on tip to use 
xorshift32+ with 64-bit state, which is much much stronger (passes 
SmallCrush, for instance), and thus fixes the unfairness in select for 
good, whatever reduction is used. To avoid regressions, the new generator 
wasn't backported to 1.9.2, but instead the fastrandn() multiplication 
change was reverted.

So to recap:

up to 1.8: LFSR+modulus => select is "fair enough"
1.9.0 / 1.9.1: LFSR+multiplication => select is very unfair
1.9.2: LFSR+modulus => select is "fair enough" (same as 1.8)
tip: xorshift32+multiplication => select is fair

Giovanni 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to