fn balanced() -> Self {
        // Randomly generate a number between 0 and 1.
        let val = rand::thread_rng().gen_range(0..=1);

        // Check the value of generated number.
        match val {
            // If generated number is 0, return a Passive cell.
            0 => BinaryCell::Passive,
            // If generated number is 1, return a Active cell.
            _ => BinaryCell::Active,
        }
    }
/// A constructor function that generates a new BinaryCell with a balanced random state.
/// Balanced generation means that there is an equal probability for a cell to be passive or active.
A constructor function that generates a new BinaryCell with a balanced random state.
Balanced generation means that there is an equal probability for a cell to be passive or active.
A constructor function that generates a new BinaryCell with a balanced random state . Balanced generation means that there is an equal probability for a cell to be passive or active .
fn balanced() -> Self {
        // Randomly generate a number between 0 and 1.
        let val = rand::thread_rng().gen_range(0..=1);
        // Check the value of generated number.
        match val {
            // If generated number is 0, return a Passive cell.
            0 => BinaryCell::Passive,
            // If generated number is 1, return a Active cell.
            _ => BinaryCell::Active,
        }
    }
fn balanced ( ) -> Self { // Randomly generate a number between 0 and 1. let val = rand :: thread_rng ( ) . gen_range ( 0 ..= 1 ) ; // Check the value of generated number. match val { // If generated number is 0, return a Passive cell. 0 => BinaryCell :: Passive , // If generated number is 1, return a Active cell. _ => BinaryCell :: Active , } }
A constructor function that generates a new BinaryCell with a balanced random state.
A constructor function that generates a new BinaryCell with a balanced random state .