| Crates.io | zipf |
| lib.rs | zipf |
| version | 7.0.2 |
| created_at | 2017-01-22 21:25:35.737194+00 |
| updated_at | 2025-02-08 20:46:22.177993+00 |
| description | A fast generator of discrete, bounded Zipf-distributed random numbers |
| homepage | |
| repository | https://github.com/jonhoo/rust-zipf |
| max_upload_size | |
| id | 8181 |
| size | 46,089 |
[!CAUTION] This crate is deprecated. Prefer
rand_distr::Zipf.
Rust implementation of a fast, discrete, bounded,
Zipf-distributed random
number generator. Compared to the implementation provided by
randomkit (which binds
to NumPy's fork of RandomKit), this crate is approximately twice as
fast:
$ cargo +nightly bench
test tests::bench_randomkit ... bench: 339 ns/iter (+/- 18)
test tests::bench_us ... bench: 68 ns/iter (+/- 1)
test tests::bench_threadrng ... bench: 11 ns/iter (+/- 0)
It is also both driven by, and provides, a Rust random number generator.
This implementation is effectively a direct port of Apache Common's RejectionInversionZipfSampler, written in Java. It is based on the method described by Wolfgang Hörmann and Gerhard Derflinger in Rejection-inversion to generate variates from monotone discrete distributions from ACM Transactions on Modeling and Computer Simulation (TOMACS) 6.3 (1996).