rust_qrng 0.1.2

Tsotchkes quantum random number generator library with cryptographic, financial, and gaming applications converted to Rust
Documentation
// filepath: rust_qrng/src/crypto/quantum_chain.rs
#[derive(Debug)]
pub struct QuantumChain {
    chain: Vec<f64>,
}

impl QuantumChain {
    pub fn new() -> Self {
        QuantumChain {
            chain: Vec::new(),
        }
    }

    pub fn add(&mut self, value: f64) {
        self.chain.push(value);
    }

    pub fn get_chain(&self) -> Vec<f64> {
        self.chain.clone()
    }

    pub fn clear(&mut self) {
        self.chain.clear();
    }
}

// Helper functions for the example
pub fn initialize_chain() -> QuantumChain {
    QuantumChain::new()
}

pub fn update_chain(chain: &QuantumChain) -> QuantumChain {
    let mut new_chain = chain.clone();
    new_chain.add(1.0);
    new_chain
}

impl Clone for QuantumChain {
    fn clone(&self) -> Self {
        QuantumChain {
            chain: self.chain.clone(),
        }
    }
}