fn random_in_unit_disk() -> Vec3 {
    // Random number generator
    let mut rng = rand::thread_rng();

    loop {
        let p = 2.0 * Vec3(rng.gen::<f32>(), rng.gen::<f32>(), 0.0) - Vec3(1., 1., 0.);
        if p.squared_length() < 1.0 {
            break p;
        }
    }
}
// Choose a vector on the unit disk.
Choose a vector on the unit disk.
Choose a vector on the unit disk .
fn random_in_unit_disk() -> Vec3 {
    // Random number generator
    let mut rng = rand::thread_rng();
    loop {
        let p = 2.0 * Vec3(rng.gen::<f32>(), rng.gen::<f32>(), 0.0) - Vec3(1., 1., 0.);
        if p.squared_length() < 1.0 {
            break p;
        }
    }
}
fn random_in_unit_disk ( ) -> Vec3 { // Random number generator let mut rng = rand :: thread_rng ( ) ; loop { let p = 2.0 * Vec3 ( rng . gen :: < f32 > ( ) , rng . gen :: < f32 > ( ) , 0.0 ) - Vec3 ( 1. , 1. , 0. ) ; if p . squared_length ( ) < 1.0 { break p ; } } }
Choose a vector on the unit disk.
Choose a vector on the unit disk .