From 93e2f08a6bfe38c1d0beb052437ee9bf0519ce4a Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Sat, 5 Sep 2015 10:19:48 -0700 Subject: [PATCH] Rebuild --- examples/random-numbers/random-numbers.hash | 4 ++-- public/random-numbers | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/random-numbers/random-numbers.hash b/examples/random-numbers/random-numbers.hash index e68f800..fa0ec46 100644 --- a/examples/random-numbers/random-numbers.hash +++ b/examples/random-numbers/random-numbers.hash @@ -1,2 +1,2 @@ -6ce1f98d3c22ee8bf02c41b393361d6cd5fff23a -TZElZIwNU1 +8e97de760147b061dd09939db294c892211b6b80 +ZdFpbahgC1 diff --git a/public/random-numbers b/public/random-numbers index 1221235..33ea2cf 100644 --- a/public/random-numbers +++ b/public/random-numbers @@ -41,7 +41,7 @@ generation.

- +
package main
 
@@ -124,7 +124,7 @@ other ranges, for example 5.0 <= f' < 10.0.

The default number generator is deterministic, so it’ll produce the same sequence of numbers each time by default. -To make it non-deterministic, give it a seed that changes. +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.

@@ -167,6 +167,10 @@ produces the same sequence of random numbers.

fmt.Print(r2.Intn(100), ",") fmt.Print(r2.Intn(100)) fmt.Println() + s3 := rand.NewSource(42) + r3 := rand.New(s3) + fmt.Print(r3.Intn(100), ",") + fmt.Print(r3.Intn(100)) } @@ -187,6 +191,7 @@ produces the same sequence of random numbers.

81,87 0.6645600532184904 7.123187485356329,8.434115364335547 +0,28 5,87 5,87