Version bump rand

This commit is contained in:
2021-05-31 10:10:45 -07:00
parent 9dcb36612d
commit bf8b533b15
13 changed files with 1179 additions and 1127 deletions

View File

@@ -60,15 +60,10 @@ where
rec1.t = 0.;
}
let distance_inside_boundary = (rec2.t - rec1.t) * r.direction.length();
let hit_distance = -(1. / self.density) * rng.gen_range::<f32>(0., 1.).ln();
let hit_distance: f32 = -(1. / self.density) * rng.gen::<f32>().ln();
if hit_distance < distance_inside_boundary {
let t = rec1.t + hit_distance / r.direction.length();
let normal = Vec3::new(
rng.gen_range(0., 1.),
rng.gen_range(0., 1.),
rng.gen_range(0., 1.),
)
.unit_vector();
let normal = Vec3::new(rng.gen(), rng.gen(), rng.gen()).unit_vector();
return Some(HitRecord {
t,
p: r.point_at_parameter(t),