pub fn random_on_unit_sphere() -> Vector3 {
        let mut rng = rand::thread_rng();
        let mut p;
        loop {
            p = Vector3::new(rng.gen::<f32>(), rng.gen::<f32>(), rng.gen::<f32>()) * 2.0 - Vector3::new(1.0, 1.0, 1.0);

            if p.length_squared() < 1.0 {
                break;
            }
        }

        p.normalized()
    }
/// Returns a random `Vector3` on a sphere of radius 1.
Returns a random `Vector3` on a sphere of radius 1.
Returns a random ` Vector3 ` on a sphere of radius 1 .
pub fn random_on_unit_sphere() -> Vector3 {
        let mut rng = rand::thread_rng();
        let mut p;
        loop {
            p = Vector3::new(rng.gen::<f32>(), rng.gen::<f32>(), rng.gen::<f32>()) * 2.0 - Vector3::new(1.0, 1.0, 1.0);
            if p.length_squared() < 1.0 {
                break;
            }
        }
        p.normalized()
    }
pub fn random_on_unit_sphere ( ) -> Vector3 { let mut rng = rand :: thread_rng ( ) ; let mut p ; loop { p = Vector3 :: new ( rng . gen :: < f32 > ( ) , rng . gen :: < f32 > ( ) , rng . gen :: < f32 > ( ) ) * 2.0 - Vector3 :: new ( 1.0 , 1.0 , 1.0 ) ; if p . length_squared ( ) < 1.0 { break ; } } p . normalized ( ) }
Returns a random `Vector3` on a sphere of radius 1.
Returns a random ` Vector3 ` on a sphere of radius 1 .