99
1010//! The Cauchy distribution `Cauchy(x₀, γ)`.
1111
12- use crate :: { Distribution , Standard } ;
12+ use crate :: { Distribution , StandardUniform } ;
1313use core:: fmt;
1414use num_traits:: { Float , FloatConst } ;
1515use rand:: Rng ;
@@ -58,7 +58,7 @@ use rand::Rng;
5858pub struct Cauchy < F >
5959where
6060 F : Float + FloatConst ,
61- Standard : Distribution < F > ,
61+ StandardUniform : Distribution < F > ,
6262{
6363 median : F ,
6464 scale : F ,
@@ -85,7 +85,7 @@ impl std::error::Error for Error {}
8585impl < F > Cauchy < F >
8686where
8787 F : Float + FloatConst ,
88- Standard : Distribution < F > ,
88+ StandardUniform : Distribution < F > ,
8989{
9090 /// Construct a new `Cauchy` with the given shape parameters
9191 /// `median` the peak location and `scale` the scale factor.
@@ -100,11 +100,11 @@ where
100100impl < F > Distribution < F > for Cauchy < F >
101101where
102102 F : Float + FloatConst ,
103- Standard : Distribution < F > ,
103+ StandardUniform : Distribution < F > ,
104104{
105105 fn sample < R : Rng + ?Sized > ( & self , rng : & mut R ) -> F {
106106 // sample from [0, 1)
107- let x = Standard . sample ( rng) ;
107+ let x = StandardUniform . sample ( rng) ;
108108 // get standard cauchy random number
109109 // note that π/2 is not exactly representable, even if x=0.5 the result is finite
110110 let comp_dev = ( F :: PI ( ) * x) . tan ( ) ;
@@ -166,7 +166,7 @@ mod test {
166166 fn value_stability ( ) {
167167 fn gen_samples < F : Float + FloatConst + fmt:: Debug > ( m : F , s : F , buf : & mut [ F ] )
168168 where
169- Standard : Distribution < F > ,
169+ StandardUniform : Distribution < F > ,
170170 {
171171 let distr = Cauchy :: new ( m, s) . unwrap ( ) ;
172172 let mut rng = crate :: test:: rng ( 353 ) ;
0 commit comments