// ---
// tags: jali, rust
// crystal-type: source
// crystal-domain: comp
// ---
//! Error distribution sampling (deterministic, from seed).
//!
//! Uses xorshift64 as a simple PRNG for reproducibility and testing.
//! NOT cryptographically secure โ real deployments would use
//! hemera-based extraction.
use Goldilocks;
use P;
use crateRingElement;
/// Simple xorshift64 PRNG state.
/// Sample a uniform random ring element.
///
/// Each coefficient is a uniformly random element of F_p,
/// produced by rejection sampling from u64 values.
/// Sample a ternary ring element with coefficients in {-1, 0, 1}.
///
/// Each coefficient is chosen roughly uniformly from {-1, 0, 1}.
/// Sample from a centered binomial distribution with parameter eta.
///
/// CBD(eta): sample 2*eta bits, compute (sum of first eta) - (sum of second eta).
/// Result is in {-eta, ..., eta}.
jali/rs/src/sample.rs
ฯ 0.0%