use std::collections::HashMap; use unity_random::Random; #[test] fn inside_unit_circle() { let mut random = Random::new(); let mut map = HashMap::new(); map.insert( 0, [ (-0.5568735, 0.3252837), (-0.2231333, 0.4286076), (-0.2005469, -0.5566905), (-0.405624, 0.5776114), (-0.1846074, -0.9116018), ], ); map.insert( 1, [ (0.4751172, 0.0009412759), (-0.308636, 0.666549), (-0.3846249, 0.2593728), (0.7976097, 0.475883), (-0.02884089, -0.6656236), ], ); map.insert( 358118, [ (-0.4736371, 0.7924381), (0.568339, 0.2900833), (0.4668945, 0.1359149), (-0.9719155, 0.01098891), (0.6989536, 0.7077643), ], ); map.insert( 30029247, [ (-0.5878728, -0.3794819), (0.6351724, 0.5193423), (0.5896927, -0.5685552), (-0.4813436, 0.7190998), (0.4176237, 0.8590526), ], ); map.insert( 719188662, [ (-0.1262154, -0.8890297), (0.9354575, 0.2605929), (0.3340298, -0.7768455), (-0.5394579, 0.7793431), (-0.6767728, -0.0851628), ], ); for (seed, values) in map { random.init_state(seed); for point in values { let result = random.inside_unit_circle(); assert!((point.0 - result.0).abs() < f32::EPSILON); assert!((point.1 - result.1).abs() < f32::EPSILON); } } }