[go] math/rand/v2: document PCG and ChaCha8 tradeoffs

1 view
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Jun 9, 2026, 10:10:42 PM (7 hours ago) Jun 9
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

math/rand/v2: document PCG and ChaCha8 tradeoffs

Document that PCG is the fast general-purpose source and ChaCha8 trades speed for stronger resistance to prediction.

Fixes #79891

This PR will be imported into Gerrit with the title and first
comment (this text) used to generate the subject and body of
the Gerrit change.

**Please ensure you adhere to every item in this list.**

More info can be found at https://go.dev/wiki/CommitMessage

+ The PR title is formatted as follows: `net/http: frob the quux before blarfing`
+ The package name goes before the colon
+ The part after the colon uses the verb tense + phrase that completes the blank in,
"This change modifies Go to ___________"
+ Lowercase verb after the colon
+ No trailing period
+ Keep the title as short as possible, ideally 72 characters or shorter
+ No Markdown
+ The first PR comment (this one) is wrapped at around 72 characters, unless it's
really needed (ASCII art, table, or long link)
+ If there is a corresponding issue, add either `Fixes #1234` or `Updates #1234`
(the latter if this is not a complete fix) to this comment
+ If referring to a repo other than `golang/go` you can use the
`owner/repo#issue_number` syntax: `Fixes golang/vscode-go#1234`
+ We do not use Signed-off-by lines in Go. Please don't add them.
Our Gerrit server & GitHub bots enforce CLA compliance instead.
+ Delete these instructions once you have read and applied them
Change-Id: Ic4133dd9bd860c2643c622f799f2c54b1678e4f0
GitHub-Last-Rev: 45f06afd4481b8b9dcd4c9822733dd30de7b18ac
GitHub-Pull-Request: golang/go#79926

Change diff

diff --git a/src/math/rand/v2/rand.go b/src/math/rand/v2/rand.go
index f6b2e47..19af211 100644
--- a/src/math/rand/v2/rand.go
+++ b/src/math/rand/v2/rand.go
@@ -12,6 +12,9 @@
// Top-level functions, such as [Float64] and [Int],
// are safe for concurrent use by multiple goroutines.
//
+// The [PCG] source is a fast general-purpose pseudo-random generator.
+// The [ChaCha8] source trades speed for stronger resistance to prediction.
+//
// This package's outputs might be easily predictable regardless of how it's
// seeded. For random numbers suitable for security-sensitive work, see the
// [crypto/rand] package.

Change information

Files:
  • M src/math/rand/v2/rand.go
Change size: XS
Delta: 1 file changed, 3 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ic4133dd9bd860c2643c622f799f2c54b1678e4f0
Gerrit-Change-Number: 789040
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gerrit Bot (Gerrit)

unread,
Jun 9, 2026, 10:52:23 PM (7 hours ago) Jun 9
to Harjoth Khara, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Robert Griesemer and Russ Cox

Gerrit Bot uploaded new patchset

Gerrit Bot uploaded patch set #2 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Robert Griesemer
  • Russ Cox
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ic4133dd9bd860c2643c622f799f2c54b1678e4f0
Gerrit-Change-Number: 789040
Gerrit-PatchSet: 2
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Filippo Valsorda <fil...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-CC: Harjoth Khara <harjot...@gmail.com>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Attention: Robert Griesemer <g...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages