diff --git a/src/geometry/unit_complex_construction.rs b/src/geometry/unit_complex_construction.rs index fc1ff131..9f300f3d 100644 --- a/src/geometry/unit_complex_construction.rs +++ b/src/geometry/unit_complex_construction.rs @@ -2,10 +2,7 @@ use quickcheck::{Arbitrary, Gen}; #[cfg(feature = "rand-no-std")] -use rand::{ - distributions::{Distribution, Uniform, uniform::SampleUniform, Standard}, - Rng, -}; +use rand::{distributions::{Distribution, Standard}, Rng}; use num::One; use num_complex::Complex; @@ -401,13 +398,13 @@ where impl Distribution> for Standard where N::Element: SimdRealField, - N: SampleUniform, + rand_distr::UnitCircle: Distribution<[N; 2]>, { /// Generate a uniformly distributed random `UnitComplex`. #[inline] fn sample<'a, R: Rng + ?Sized>(&self, rng: &mut R) -> UnitComplex { - let twopi = Uniform::new(N::zero(), N::simd_two_pi()); - UnitComplex::from_angle(rng.sample(twopi)) + let x = rng.sample(rand_distr::UnitCircle); + UnitComplex::new_unchecked(Complex::new(x[0], x[1])) } }