1
0
mirror of https://github.com/golang/go synced 2024-10-05 08:21:22 -06:00
go/src/pkg/math/rand
Russ Cox ff2534e076 undo CL 6845121 / 79603a5e4cda
This changes the output of

rand.Seed(0)
perm := rand.Perm(100)

When giving the same seeds to Go 1.0 and Go 1.1 programs
I would like them to generate the same random numbers.

««« original CL description
math/rand: remove noop iteration in Perm

The first iteration always do `m[0], m[0] = m[0], m[0]`, because
`rand.Intn(1)` is 0.

fun note: IIRC in TAOCP version of this algorithm, `i` goes
backward (n-1->1), meaning that the "already" shuffled part of the
array is never altered betweens iterations, while in the current
implementation the "not-yet" shuffled part of the array is
conserved between iterations.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6845121

»»»

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6905049
2012-12-07 11:58:44 -05:00
..
exp.go
normal.go
rand_test.go math/rand: avoid use of math.Pow in tests. 2012-07-04 00:38:01 +02:00
rand.go undo CL 6845121 / 79603a5e4cda 2012-12-07 11:58:44 -05:00
rng.go
zipf.go