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.