Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
e9546a01
Commit
e9546a01
authored
Apr 27, 2013
by
Brad Fitzpatrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
math/rand: fix typo and add better crash message
R=golang-dev, r CC=golang-dev
https://golang.org/cl/9000043
parent
d09f34cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
src/pkg/math/rand/zipf.go
src/pkg/math/rand/zipf.go
+4
-2
No files found.
src/pkg/math/rand/zipf.go
View file @
e9546a01
...
...
@@ -34,7 +34,6 @@ func (z *Zipf) hinv(x float64) float64 {
// NewZipf returns a Zipf generating variates p(k) on [0, imax]
// proportional to (v+k)**(-s) where s>1 and k>=0, and v>=1.
//
func
NewZipf
(
r
*
Rand
,
s
float64
,
v
float64
,
imax
uint64
)
*
Zipf
{
z
:=
new
(
Zipf
)
if
s
<=
1.0
||
v
<
1
{
...
...
@@ -52,9 +51,12 @@ func NewZipf(r *Rand, s float64, v float64, imax uint64) *Zipf {
return
z
}
// Uint64 returns a value drawn from the Zipf distribut
ed
described
// Uint64 returns a value drawn from the Zipf distribut
ion
described
// by the Zipf object.
func
(
z
*
Zipf
)
Uint64
()
uint64
{
if
z
==
nil
{
panic
(
"rand: nil Zipf"
)
}
k
:=
0.0
for
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment