MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / random_unit_vec

Function random_unit_vec

examples/cuda/gpu/path_tracer_gpu/src/math.rs:13–17  ·  view source on GitHub ↗
(state: &mut DefaultRand)

Source from the content-addressed store, hash-verified

11}
12
13pub fn random_unit_vec(state: &mut DefaultRand) -> Vec3 {
14 let [x, y] = state.normal_f32_2();
15 let z = state.normal_f32();
16 Vec3::new(x, y, z)
17}
18
19/// Creates a random vector with each element being in the range of [-1.0, 1.0] (signed normalized).
20pub fn random_snorm_vec(state: &mut DefaultRand) -> Vec3 {

Callers 1

random_snorm_vecFunction · 0.85

Calls 3

newFunction · 0.85
normal_f32_2Method · 0.80
normal_f32Method · 0.80

Tested by

no test coverage detected