57 releases

Uses old Rust 2015

0.18.0 Mar 6, 2022
0.17.0 Jul 6, 2019
0.16.0 Jun 9, 2019
0.15.12 Oct 6, 2018
0.0.1 Nov 20, 2014

#23 in Algorithms

Download history 1504/week @ 2022-03-11 1915/week @ 2022-03-18 1581/week @ 2022-03-25 7043/week @ 2022-04-01 10064/week @ 2022-04-08 9928/week @ 2022-04-15 6103/week @ 2022-04-22 2161/week @ 2022-04-29 2278/week @ 2022-05-06 3086/week @ 2022-05-13 1871/week @ 2022-05-20 2524/week @ 2022-05-27 2379/week @ 2022-06-03 2294/week @ 2022-06-10 2242/week @ 2022-06-17 1884/week @ 2022-06-24

9,208 downloads per month
Used in 19 crates (13 directly)

Apache-2.0/MIT

120KB
4K SLoC

Probability Package Documentation Build

The package provides a probability-theory toolbox.

Example

use probability::prelude::*;

let mut source = source::default();
let distribution = Uniform::new(0.0, 1.0);
let sampler = Independent(&distribution, &mut source);
let samples = sampler.take(10).collect::<Vec<_>>();

Sources of randomness are provided by the random crate via the source module. In addition, one can make use of those sources that are available in the rand crate as illustrated below:

use probability::prelude::*;

struct Source<T>(T);

impl<T: rand::RngCore> source::Source for Source<T> {
    fn read_u64(&mut self) -> u64 {
        self.0.next_u64()
    }
}

let mut source = Source(rand::rngs::OsRng::new().unwrap());
let distribution = Uniform::new(0.0, 1.0);
let sampler = Independent(&distribution, &mut source);
let samples = sampler.take(10).collect::<Vec<_>>();

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.md.

Dependencies

~72KB