pecos_core/sims_rngs/
cyclic_rng.rs1use super::sim_rng::SimRng;
14use rand::{Error, RngCore, SeedableRng};
15
16const N: usize = 64;
17
18#[derive(Debug)]
19pub struct CyclicSeed(pub [u8; N]);
20
21impl Default for CyclicSeed {
22 #[inline]
23 fn default() -> Self {
24 Self([0; N])
25 }
26}
27
28impl AsMut<[u8]> for CyclicSeed {
29 #[inline]
30 fn as_mut(&mut self) -> &mut [u8] {
31 &mut self.0
32 }
33}
34
35#[allow(unused)]
36#[derive(Debug)]
37pub struct CyclicRng {
38 seed: CyclicSeed,
39 bools: Vec<bool>,
40}
41
42impl CyclicRng {
43 #[allow(dead_code)]
44 #[inline]
45 fn set_bools(&mut self, bools: &[bool]) {
46 bools.clone_into(&mut self.bools);
47 }
48}
49
50impl RngCore for CyclicRng {
51 #[allow(unused)]
52 #[inline]
53 fn next_u32(&mut self) -> u32 {
54 todo!()
55 }
56
57 #[allow(unused)]
58 #[inline]
59 fn next_u64(&mut self) -> u64 {
60 todo!()
61 }
62
63 #[allow(unused)]
64 #[inline]
65 fn fill_bytes(&mut self, dest: &mut [u8]) {
66 todo!()
67 }
68
69 #[allow(unused)]
70 #[inline]
71 fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
72 todo!()
73 }
74}
75
76impl SeedableRng for CyclicRng {
77 type Seed = CyclicSeed;
78
79 #[inline]
80 fn from_seed(seed: Self::Seed) -> Self {
81 Self {
82 seed,
83 bools: vec![],
84 }
85 }
86}
87
88impl SimRng for CyclicRng {}