Module datagen

Module datagen 

Source
Expand description

§Datagen: Synthetic Data Generators for Validation

This module provides generators that produce synthetic data with known theoretical entropy values. Useful for validating entropy estimators and creating reproducible test cases.

§Example

use infotheory::datagen::{bernoulli, uniform_random};

// Bernoulli(0.5) has H(p) = 1.0 bit
let data = bernoulli(1000, 0.5, 42);

// Uniform random bytes have H = 8.0 bits/byte
let uniform = uniform_random(1000, 42);

Functions§

bernoulli
Generate a Bernoulli bit sequence with probability p of each bit being 1.
bernoulli_entropy
Theoretical entropy for a Bernoulli(p) source in bits.
deterministic_func
Generate a functionally dependent pair Y = f(X).
highly_compressible
Generate a highly compressible string (repeating pattern).
identical_pair
Generate two identical sequences (for testing identity properties).
independent_pair
Generate two independent random sequences (for testing independence properties).
markov_1_binary
Generate a first-order binary Markov chain.
markov_1_binary_entropy_rate
Theoretical entropy rate for a binary Markov chain with transition probs p00, p11.
noisy_channel
Generate a Binary Symmetric Channel (BSC) output.
periodic
Generate a periodic sequence by repeating a pattern.
uniform_random
Generate uniform random bytes.
xor_pair
Generate three sequences X, Y, Z where Z = X XOR Y.