Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(321)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 176070: Zipf distributed random variates.

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 1 month ago by wjosephson
Modified:
8 years, 4 months ago
Reviewers:
rsc
CC:
rsc
Visibility:
Public.
Zipf distributed random variates.

Patch Set 1 #

Total comments: 6

Patch Set 2 : code review 176070: Zipf distributed random variates. #

Patch Set 3 : code review 176070: Zipf distributed random variates. #

Created: 16 years, 1 month ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+74 lines, -0 lines) Patch
M src/pkg/rand/Makefile View 1 chunk +1 line, -0 lines 0 comments Download
A src/pkg/rand/zipf.go View 1 1 chunk +73 lines, -0 lines 0 comments Download
Total messages: 4
|
rsc
looks pretty good. a few minor nits. http://codereview.appspot.com/176070/diff/1/3 File src/pkg/rand/zipf.go (right): http://codereview.appspot.com/176070/diff/1/3#newcode14 src/pkg/rand/zipf.go:14: // A ...
16 years, 1 month ago (2009年12月14日 03:13:10 UTC) #1
looks pretty good.
a few minor nits.
http://codereview.appspot.com/176070/diff/1/3
File src/pkg/rand/zipf.go (right):
http://codereview.appspot.com/176070/diff/1/3#newcode14
src/pkg/rand/zipf.go:14: // A Zipf generates Zipf distributed variates
period at end of sentence
http://codereview.appspot.com/176070/diff/1/3#newcode52
src/pkg/rand/zipf.go:52: // Initialize a Zipf so that variates p(k) are
generated on [0, imax]
should be a sentence.
NewZipf returns a Zipf generating p(k) on [0, imax] 
proportional to (v+k)**(-s) where s>1, k>=0, and v>=1.
(I added the v >= 1.)
http://codereview.appspot.com/176070/diff/1/3#newcode57
src/pkg/rand/zipf.go:57: if v == 0 {
So v == 0 is okay but other v < 1 is not?
Seems cleaner to require v >= 1 and drop this,
but I don't know what the usages are like.
http://codereview.appspot.com/176070/diff/1/3#newcode60
src/pkg/rand/zipf.go:60: if z.init(r, s, v, imax) {
might as well inline the init call since it is not
used elsewhere.
http://codereview.appspot.com/176070/diff/1/3#newcode69
src/pkg/rand/zipf.go:69: var k = float64(0.0);
s/var k =/k :=/
http://codereview.appspot.com/176070/diff/1/3#newcode78
src/pkg/rand/zipf.go:78: } else if ur >=
z.h(k+0.5)-math.Exp(-math.Log(k+z.v)*z.q) {
no need for else since the if broke.
}
if ur >= ...
(or use || above)
Sign in to reply to this message.
rsc
looks good to me; thanks.
16 years, 1 month ago (2009年12月16日 05:05:11 UTC) #2
looks good to me; thanks.
Sign in to reply to this message.
rsc
LGTM When you hg sync you're going to get a merge conflict because I've stripped ...
16 years, 1 month ago (2009年12月16日 05:10:28 UTC) #3
LGTM
When you hg sync you're going to get a merge
conflict because I've stripped the semicolons
with hg gofmt. You'll be able to resolve it with
cd $GOROOT/src/pkg/rand
hg revert zipf.go
hg resolve -m zipf.go # marks it resolved
Sign in to reply to this message.
rsc
*** Submitted as http://code.google.com/p/go/source/detail?r=230b42431917 *** rand: Zipf distributed random variates. R=rsc http://codereview.appspot.com/176070 Committer: Russ Cox ...
16 years, 1 month ago (2009年12月16日 05:10:39 UTC) #4
*** Submitted as http://code.google.com/p/go/source/detail?r=230b42431917 ***
rand: Zipf distributed random variates.
R=rsc
http://codereview.appspot.com/176070
Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.
|
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /