Skip to main content

Crate distr_combinators

Crate distr_combinators 

Source
Expand description

Combinators for rand::distr::Distribution objects

This module provides tools to compose and transform probability distributions in a functional style. It is designed to be generic and independent of any specific data structures.

Re-exports§

pub use histogram::Histogram;

Modules§

histogram
A convenience to analyze the distribution of generated values

Structs§

Categorical
A categorical distribution that selects from elements based on an index distribution ed.
Choice2
A distribution that chooses between dx and dy based on a boolean distribution db.
Collected
A distribution that samples from d, maps using pf, and retries if pf returns None.
Concentrated
A stateful distribution that accumulates samples from dx into state z until fa returns a value.
Degenerate
A constant distribution that always returns element.
Dependent2
A distribution where the choice of the second distribution depends on the value sampled from the first.
Diluted
A distribution that expands a single sample from dx into a sequence of values.
Filtered
A distribution that samples from d but rejects values that do not satisfy predicate p.
Mapped
A distribution that maps values sampled from d using function f.
Product2
A distribution that combines two independent distributions dx and dy using a function f.
Repeated
A distribution that generates a vector of items with length sampled from lengthd and items from itemd.
Sentinel
A distribution that generates a vector of bytes by sampling from mbd until None is returned.

Functions§

ratios
Creates a categorical distribution where elements are chosen with probability proportional to their weights.