Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12)

Issue 6905049: code review 6905049: undo CL 6845121 / 79603a5e4cda (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 7 months ago by rsc
Modified:
9 years, 7 months ago
Reviewers:
CC:
golang-dev, bradfitz
Visibility:
Public.

Description

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://codereview.appspot.com/6845121 Committer: Brad Fitzpatrick <bradfitz@golang.org> »»»

Patch Set 1 #

Patch Set 2 : diff -r a5efcd1675eb https://code.google.com/p/go/ #

Patch Set 3 : diff -r a5efcd1675eb https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M src/pkg/math/rand/rand.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
9 years, 7 months ago (2012-12-07 14:47:28 UTC) #1
bradfitz
LGTM On Fri, Dec 7, 2012 at 6:47 AM, <rsc@golang.org> wrote: > Reviewers: golang-dev_googlegroups.com, > ...
9 years, 7 months ago (2012-12-07 16:30:56 UTC) #2
rsc
9 years, 7 months ago (2012-12-07 16:58:52 UTC) #3
*** Submitted as https://code.google.com/p/go/source/detail?r=d636ee0a2861 ***

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://codereview.appspot.com/6845121

Committer: Brad Fitzpatrick <bradfitz@golang.org>
»»»

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/6905049
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b