Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: change fastrandn to use % again #22253

rsc opened this issue Oct 13, 2017 · 3 comments


None yet
2 participants
Copy link

commented Oct 13, 2017

See #21806. For Go 1.9.2 we want to just go back to %, which is what Go 1.8 and earlier used and is well tested.

@rsc rsc added this to the Go1.9.2 milestone Oct 13, 2017


This comment has been minimized.

Copy link

commented Oct 15, 2017

Change mentions this issue: [release-branch.go1.9] runtime: use simple, more robust fastrandn


This comment has been minimized.

Copy link
Contributor Author

commented Oct 15, 2017

CL 70991 OK for Go 1.9.2.

gopherbot pushed a commit that referenced this issue Oct 25, 2017

[release-branch.go1.9] runtime: use simple, more robust fastrandn
CL 36932 (speed up fastrandn) made it faster but introduced
bad interference with some properties of fastrand itself, making
fastrandn not very random in certain ways. In particular, certain
selects are demonstrably unfair.

For Go 1.10 the new faster fastrandn has induced a new fastrand,
which in turn has caused other follow-on bugs that are still being
discovered and fixed.

For Go 1.9.2, just go back to the barely slower % implementation
that we used in Go 1.8 and earlier. This should restore fairness in
select and any other problems caused by the clever fastrandn.

The test in this CL is copied from CL 62530.

Fixes #22253.

Change-Id: Ibcf948a7bce981452e05c90dbdac122043f6f813
Run-TryBot: Russ Cox <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Ian Lance Taylor <>
Reviewed-by: Keith Randall <>

This comment has been minimized.

Copy link
Contributor Author

commented Oct 26, 2017

go1.9.2 has been packaged and includes:

The release is posted at

—, Oct 26 21:09:23 UTC

@rsc rsc closed this Oct 26, 2017

@golang golang locked and limited conversation to collaborators Oct 26, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.