aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff R. Allen <jra@nella.org>2016-05-24 23:00:06 +0600
committerIan Lance Taylor <iant@golang.org>2016-05-24 19:07:46 +0000
commit3474610fbc81f7e9f3f2cb23dc1554b3f5cec657 (patch)
tree7285bee0906a7213ce4c4813c8d0e04435a40556 /src
parent2f9eeea212681927385a4713004438cd864966e0 (diff)
downloadgo-3474610fbc81f7e9f3f2cb23dc1554b3f5cec657.tar.xz
math/rand: Doc fix for how many bits Seed uses
Document the fact that the default Source uses only the bottom 31 bits of the given seed. Fixes #15788 Change-Id: If20d1ec44a55c793a4a0a388f84b9392c2102bd1 Reviewed-on: https://go-review.googlesource.com/23352 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/math/rand/rand.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/math/rand/rand.go b/src/math/rand/rand.go
index d693bfb52f..add039ed4b 100644
--- a/src/math/rand/rand.go
+++ b/src/math/rand/rand.go
@@ -179,7 +179,8 @@ var globalRand = New(&lockedSource{src: NewSource(1)})
// Seed uses the provided seed value to initialize the default Source to a
// deterministic state. If Seed is not called, the generator behaves as
-// if seeded by Seed(1).
+// if seeded by Seed(1). Only uses the bottom 31 bits of seed; the top 33
+// bits are ignored.
func Seed(seed int64) { globalRand.Seed(seed) }
// Int63 returns a non-negative pseudo-random 63-bit integer as an int64