Fix spherical random
This commit is contained in:
parent
d390df6564
commit
cec72b0661
|
|
@ -122,9 +122,9 @@ fn rand_float() -> f32 {
|
|||
|
||||
fn rand_sphere() -> vec3f {
|
||||
loop {
|
||||
let v = vec3f(rand_float(), rand_float(), rand_float());
|
||||
let v = vec3f(rand_float(), rand_float(), rand_float()) - 0.5;
|
||||
let l = length(v);
|
||||
if (length(v) <= 1.0) {
|
||||
if (length(v) <= 0.5) {
|
||||
return v / l;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user