Skip to main content

Crate tpt_math_prob_core

Crate tpt_math_prob_core 

Source
Expand description

Shared randomness traits for the tpt-math-prob-* family.

This crate defines the traits the probability crates implement against:

  • Rng — a minimal source of pseudo-random bits (no std, no alloc).
  • Distribution<T> — a thing that can draw a value of type T.
  • Sampler<T> — blanket-implemented for every Distribution, adding bulk-sampling helpers that write into a caller-provided slice.

It also ships SplitMix64, a small deterministic PRNG, so consumers have a working Rng even in no_std environments where rand is unavailable.

§Examples

use tpt_math_prob_core::{Rng, Distribution, Standard, SplitMix64};

let mut rng = SplitMix64::seed_from_u64(42);
let x: f64 = Standard.sample(&mut rng);
assert!((0.0..=1.0).contains(&x));

Re-exports§

pub use tpt_math_numeric as numeric;

Modules§

special
Special functions (log-gamma, incomplete gamma/beta, erf, normal CDF). Special functions shared by the tpt-math-prob-* and tpt-math-stats crates.

Structs§

SplitMix64
SplitMix64: a tiny, fast, deterministic 64-bit PRNG.
Standard
The standard uniform distribution over the type’s natural range.

Traits§

Distribution
A distribution that can produce samples of type T.
Rng
A source of pseudo-random bits.
Sampler
Bulk sampling for any Distribution.