Draw samples from a Zipf distribution.
Numeric.random.zipf(first, count, generator)Produces rank weighted variates from the given exponent.
- Parameters:
first: Exponent parameter of the distributioncount: Number of samples to draw when givengenerator: Generator supplying uniform samples
- Returns: Single sample or array of samples
- NumPy: Equivalent to
Generator.zipf.
import Numeric from '@neabyte/numerix'
const values = Numeric.random.zipf(2, 3, Numeric.random.seed(42))
console.log(values)
// [1,1,8]import Numeric from '@neabyte/numerix'
const value = Numeric.random.zipf(2, undefined, Numeric.random.seed(42))
console.log(value)
// 1import Numeric from '@neabyte/numerix'
const values = Numeric.random.zipf(3, 3, Numeric.random.seed(42))
console.log(values)
// [1,1,2]import Numeric from '@neabyte/numerix'
const values = Numeric.random.zipf(2, 3)
console.log(values.length)
// 3