]> Cypherpunks repositories - gostls13.git/commitdiff
math/rand: clarify documentation for Seed example
authorAgniva De Sarker <agnivade@yahoo.co.in>
Fri, 11 May 2018 15:21:39 +0000 (20:51 +0530)
committerRob Pike <r@golang.org>
Sat, 12 May 2018 06:21:01 +0000 (06:21 +0000)
Fixes #25325

Change-Id: I101641be99a820722edb7272918e04e8d2e1646c
Reviewed-on: https://go-review.googlesource.com/112775
Reviewed-by: Rob Pike <r@golang.org>
src/math/rand/example_test.go

index aa1f2bcc7341ee0258efaacc9406fd648501a9fe..adeeaa0b469ac71b3b968b51e77508b9521c587d 100644 (file)
@@ -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",