Forward error correction for SDR, space, and satellite: convolutional (Viterbi) and Reed-Solomon codes, including the CCSDS (255,223) standard in both conventional and dual-basis representations.
/// A small deterministic SplitMix64 RNG. It seeds the noise in the `sim`
/// harness, so a given seed always reproduces the same run.
pubstructRng{state:u64,
}implRng{/// Creates an RNG seeded with `seed`. Public because the `sim` functions
/// that take an [`Rng`] need the caller to construct one. The generator
/// methods are crate-internal.
pubfnnew(seed:u64)-> Rng{
Rng { state: seed }}#[inline]pub(crate)fnnext_u64(&mutself)->u64{// SplitMix64
self.state =self.state.wrapping_add(0x9E37_79B9_7F4A_7C15);letmut z =self.state;
z =(z ^(z >>30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
z =(z ^(z >>27)).wrapping_mul(0x94D0_49BB_1331_11EB);
z ^(z >>31)}// only the Reed-Solomon tests need bounded draws
#[cfg(test)]pub(crate)fnnext_u64_below(&mutself, n:usize)->usize{(self.next_u64()% n asu64)asusize}#[inline]pub(crate)fnnext_f64(&mutself)->f64{// convert a random u64 to a random f64 in [0, 1)
(self.next_u64()>>11)asf64/(1u64<<53)asf64}#[inline]pub(crate)fnnext_u8(&mutself)->u8{(self.next_u64()>>(64-8))asu8}}