aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorAgniva De Sarker <agnivade@yahoo.co.in>2018-05-11 20:51:39 +0530
committerRob Pike <r@golang.org>2018-05-12 06:21:01 +0000
commitf94b5a81057ccf6d16da3a78b2ff5c08383f9768 (patch)
tree072040959fd8c5078f57047e7aef4919d9a49ef4 /src/math
parente6a9335c7fbdcfbf5fd715ffe73873cd391368df (diff)
downloadgo-f94b5a81057ccf6d16da3a78b2ff5c08383f9768.tar.xz
math/rand: clarify documentation for Seed example
Fixes #25325 Change-Id: I101641be99a820722edb7272918e04e8d2e1646c Reviewed-on: https://go-review.googlesource.com/112775 Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/math')
-rw-r--r--src/math/rand/example_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/math/rand/example_test.go b/src/math/rand/example_test.go
index aa1f2bcc73..adeeaa0b46 100644
--- a/src/math/rand/example_test.go
+++ b/src/math/rand/example_test.go
@@ -16,7 +16,10 @@ import (
// the output of the random number generator when given a fixed seed.
func Example() {
- rand.Seed(42) // Try changing this number!
+ // Seeding with the same value results in the same random sequence each run.
+ // For different numbers, seed with a different value, such as
+ // time.Now().UnixNano(), which yields a constantly-changing number.
+ rand.Seed(42)
answers := []string{
"It is certain",
"It is decidedly so",