MCPcopy Create free account
hub / github.com/PerroEngine/Perro / rand_unit_vec3

Function rand_unit_vec3

perro_source/api_modules/perro_modules/src/random.rs:314–319  ·  view source on GitHub ↗
(seed: u32)

Source from the content-addressed store, hash-verified

312
313#[inline]
314pub fn rand_unit_vec3(seed: u32) -> (f32, f32, f32) {
315 let z = rand11(seed);
316 let angle = rand01(seed.wrapping_add(STREAM_GAMMA)) * std::f32::consts::TAU;
317 let radial = (1.0 - z * z).max(0.0).sqrt();
318 (radial * angle.cos(), radial * angle.sin(), z)
319}
320
321#[inline]
322pub fn shuffle<T>(seed: u32, values: &mut [T]) {

Calls 4

rand11Function · 0.85
rand01Function · 0.85
sinMethod · 0.80
maxMethod · 0.45