diff --git a/examples/random-numbers/random-numbers.go b/examples/random-numbers/random-numbers.go index 3bd5d54..53d0f38 100644 --- a/examples/random-numbers/random-numbers.go +++ b/examples/random-numbers/random-numbers.go @@ -32,7 +32,7 @@ func main() { // produce the same sequence of numbers each time by default. // To produce varying sequences, give it a seed that changes. // Note that this is not safe to use for random numbers you - // intend to be secret, use `crypto/rand` for those. + // intend to be secret; use `crypto/rand` for those. s1 := rand.NewSource(time.Now().UnixNano()) r1 := rand.New(s1) diff --git a/examples/random-numbers/random-numbers.hash b/examples/random-numbers/random-numbers.hash index 338e522..e099cc4 100644 --- a/examples/random-numbers/random-numbers.hash +++ b/examples/random-numbers/random-numbers.hash @@ -1,2 +1,2 @@ -f0f88939692a32975d902c94066537a6ba5ab96f -RaoKyUd9tgC +ea6a386e4e5602247b2203fa433d4419ff5a9489 +Enb5uJEx0Bt diff --git a/examples/random-numbers/random-numbers.sh b/examples/random-numbers/random-numbers.sh index 3cd78b4..f9f2b5b 100644 --- a/examples/random-numbers/random-numbers.sh +++ b/examples/random-numbers/random-numbers.sh @@ -1,3 +1,8 @@ +# Depending on where you run this sample, some of the +# generated numbers may be different. Note that on +# the Go playground seeding with `time.Now()` still +# produces deterministic results due to the way the +# playground is implemented. $ go run random-numbers.go 81,87 0.6645600532184904 diff --git a/public/random-numbers b/public/random-numbers index 488191d..c1571e2 100644 --- a/public/random-numbers +++ b/public/random-numbers @@ -43,7 +43,7 @@ generation.
package main
5.0 <= f' < 10.0
.
produce the same sequence of numbers each time by default.
To produce varying sequences, give it a seed that changes.
Note that this is not safe to use for random numbers you
-intend to be secret, use crypto/rand
for those.
+intend to be secret; use crypto/rand
for those.
Depending on where you run this sample, some of the
+generated numbers may be different. Note that on
+the Go playground seeding with time.Now()
still
+produces deterministic results due to the way the
+playground is implemented.
$ go run random-numbers.go ++$ go run random-numbers.go 81,87 0.6645600532184904 7.123187485356329,8.434115364335547