Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
math/rand: remove statistical correlation in ziggurat algorithms #8731
A statistical correlation is present in the algorithms used to generate normally and exponentially distributed values due to the reuse of random bits for both the x-coordinate and the segment index. This reuse could be avoided by generating a 63-bit number, taking the low 32 bits for the x-coordinate, the next 7 or 8 bits for the segment number, and on the normal distribution, one more bit to determine the sign of values generated from the tail. For example: http://play.golang.org/p/xeCjwEFUSs
We deliberately postponed the decision in #8013. There were various arguments, but no final decision.
If the numbers that we get from the generators are statistically correlated, that sounds to me like a bug. I personally would be OK with changing the generated sequence to fix a bug.
This probably should be discussed on golang-dev, if somebody has a patch.