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

Issue 6845121: code review 6845121: math/rand: remove noop iteration in Perm

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

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.

Patch Set 1 #

Patch Set 2 : diff -r 6ec24fe2e501 http://code.google.com/p/go #

Patch Set 3 : diff -r 6ec24fe2e501 http://code.google.com/p/go #

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: 5
proppy
Hello golang-dev@googlegroups.com, I'd like you to review this change to http://code.google.com/p/go
11 years, 4 months ago (2012-12-01 09:29:17 UTC) #1
bradfitz
*** Submitted as https://code.google.com/p/go/source/detail?r=79603a5e4cda *** math/rand: remove noop iteration in Perm The first iteration always ...
11 years, 4 months ago (2012-12-01 22:11:59 UTC) #2
rsc
This changes the output generated by the random number generator with a given seed. While ...
11 years, 4 months ago (2012-12-07 14:37:01 UTC) #3
bradfitz
Add a test too, then? On Dec 7, 2012 9:37 AM, <rsc@golang.org> wrote: > This ...
11 years, 4 months ago (2012-12-07 14:44:28 UTC) #4
rsc
11 years, 4 months ago (2012-12-07 15:13:25 UTC) #5
Rollback and test sent, separately. 6905049 and 6907048
Sign in to reply to this message.

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