Random variables for rust
Developed and tested on nightly.
Random variables are designed to be flexible. For example, we don't just want a
Beta
distribution that works with f64
; we want it to work with a bunch of
things.
```rust extern crate rand; extern crate rv;
use rv::prelude::*;
// Beta(0.5, 0.5) let beta = Beta::jeffreys();
let mut rng = rand::thread_rng();
// 100 f64 weights in (0, 1)
let f64s: Vec
// 100 f32 weights in (0, 1)
let f32s: Vec
// 100 Bernoulli distributions -- Beta is a prior on the weight
let berns: Vec
Rv
,
Support
, and either ContinuousDistr
or DiscreteDistr
. Of course, more
is better!Rv<f64>
, also implement Rv<f32>
. Check out other
distributions to see how it can be done easily with macros.rustfmt
. We've included a .rustfmt.toml
in the project directory.