use std::collections::HashMap;
use unity_random::Random;
#[test]
fn inside_unit_sphere() {
let mut random = Random::new();
let mut map: HashMap<i32, [(f32, f32, f32); 5]> = HashMap::new();
map.insert(
0,
[
(-0.7462912, 0.4355676, -0.1475139),
(-0.2483938, -0.6895068, -0.4616884),
(-0.624307, 0.007195201, -0.2000411),
(0.4255203, 0.4062259, 0.628723),
(0.09393974, 0.7890219, -0.3996925),
],
);
map.insert(
1,
[
(0.00474397, 0.03087726, -0.879235),
(-0.7623613, 0.5141004, 0.07295015),
(0.231277, -0.2702885, -0.5268449),
(0.1381525, 0.6717938, -0.07746036),
(0.516916, -0.8369448, 0.07885869),
],
);
map.insert(
358118,
[
(0.5515557, -0.7366227, -0.3200788),
(0.8623052, 0.2510206, -0.1697148),
(0.8990432, -0.3253321, -0.00344083),
(0.120665, -0.05546359, 0.636704),
(-0.1364788, 0.4184574, 0.5434878),
],
);
map.insert(
30029247,
[
(-0.9440579, 0.06177174, 0.175569),
(0.4662213, -0.4495096, 0.2390822),
(-0.006731363, -0.8898976, -0.2924913),
(-0.1447194, -0.5299388, 0.801227),
(-0.5350057, -0.5384245, -0.4412423),
],
);
map.insert(
719188662,
[
(0.3039664, -0.8230771, 0.448453),
(0.1205376, -0.2803316, 0.5830047),
(0.5983661, -0.444053, -0.2405997),
(-0.2023555, 0.3666469, -0.02915556),
(-0.3058136, -0.1750615, 0.7583968),
],
);
for (seed, values) in map {
random.init_state(seed);
for point in values {
let result = random.inside_unit_sphere();
assert!((point.0 - result.0).abs() < f32::EPSILON);
assert!((point.1 - result.1).abs() < f32::EPSILON);
assert!((point.2 - result.2).abs() < f32::EPSILON);
}
}
}