rand_distr

Crates.iorand_distr
lib.rsrand_distr
version0.5.0-alpha.1
sourcesrc
created_at2019-06-12 09:20:01.272484
updated_at2024-03-18 19:13:24.973952
descriptionSampling from random number distributions
homepagehttps://rust-random.github.io/book
repositoryhttps://github.com/rust-random/rand
max_upload_size
id140575
size254,751
maintainers (github:rust-random:maintainers)

documentation

https://docs.rs/rand_distr

README

rand_distr

Test Status Latest version Book API API Minimum rustc version

Implements a full suite of random number distribution sampling routines.

This crate is a superset of the rand::distributions module, including support for sampling from Beta, Binomial, Cauchy, ChiSquared, Dirichlet, Exponential, FisherF, Gamma, Geometric, Hypergeometric, InverseGaussian, LogNormal, Normal, Pareto, PERT, Poisson, StudentT, Triangular and Weibull distributions. Sampling from the unit ball, unit circle, unit disc and unit sphere surfaces is also supported.

It is worth mentioning the statrs crate which provides similar functionality along with various support functions, including PDF and CDF computation. In contrast, this rand_distr crate focuses on sampling from distributions.

Portability and libm

The floating point functions from num_traits and libm are used to support no_std environments and ensure reproducibility. If the floating point functions from std are preferred, which may provide better accuracy and performance but may produce different random values, the std_math feature can be enabled.

Crate features

  • std (enabled by default): rand_distr implements the Error trait for its error types. Implies alloc and rand/std.
  • alloc (enabled by default): required for some distributions when not using std (in particular, Dirichlet and WeightedAliasIndex).
  • std_math: see above on portability and libm
  • serde1: implement (de)seriaialization using serde

Links

License

rand_distr is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

Commit count: 3215

cargo fmt