diff options
Diffstat (limited to 'libgo/go/math/rand/zipf.go')
-rw-r--r-- | libgo/go/math/rand/zipf.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libgo/go/math/rand/zipf.go b/libgo/go/math/rand/zipf.go index 8db2c6f5bff..f04c814eb75 100644 --- a/libgo/go/math/rand/zipf.go +++ b/libgo/go/math/rand/zipf.go @@ -32,8 +32,10 @@ func (z *Zipf) hinv(x float64) float64 { return math.Exp(z.oneminusQinv*math.Log(z.oneminusQ*x)) - z.v } -// 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. +// NewZipf returns a Zipf variate generator. +// The generator generates values k ∈ [0, imax] +// such that P(k) is proportional to (v + k) ** (-s). +// Requirements: s > 1 and v >= 1. func NewZipf(r *Rand, s float64, v float64, imax uint64) *Zipf { z := new(Zipf) if s <= 1.0 || v < 1 { |