1
0
mirror of https://github.com/golang/go synced 2024-11-24 02:00:20 -07:00

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>
This commit is contained in:
Agniva De Sarker 2018-05-11 20:51:39 +05:30 committed by Rob Pike
parent e6a9335c7f
commit f94b5a8105

View File

@ -16,7 +16,10 @@ import (
// the output of the random number generator when given a fixed seed. // the output of the random number generator when given a fixed seed.
func Example() { 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{ answers := []string{
"It is certain", "It is certain",
"It is decidedly so", "It is decidedly so",