Commit 663226d8 authored by Sokolov Yura's avatar Sokolov Yura Committed by Josh Bleecher Snyder
Browse files

runtime: make fastrand to generate 32bit values

Extend period of fastrand from (1<<31)-1 to (1<<32)-1 by
choosing other polynom and reacting on high bit before shift.

Polynomial is taken at https://users.ece.cmu.edu/~koopman/lfsr/index.html
from 32.dat.gz . It is referred as F7711115 cause this list of
polynomials is for LFSR with shift to right (and fastrand uses shift to
left). (old polynomial is referred in 31.dat.gz as 7BB88888).

There were couple of places with conversation of fastrand to int, which
leads to negative values on 32bit platforms. They are fixed.

Change-Id: Ibee518a3f9103e0aea220ada494b3aec77babb72
Reviewed-on: https://go-review.googlesource.com/36875


Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 15c62e85
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment