@@ -170,8 +170,6 @@ use Rng;
170
170
#[ doc( inline) ] pub use self :: other:: Alphanumeric ;
171
171
#[ doc( inline) ] pub use self :: uniform:: Uniform ;
172
172
#[ doc( inline) ] pub use self :: float:: { OpenClosed01 , Open01 } ;
173
- #[ deprecated( since="0.5.0" , note="use Uniform instead" ) ]
174
- pub use self :: uniform:: Uniform as Range ;
175
173
#[ cfg( feature="std" ) ]
176
174
#[ doc( inline) ] pub use self :: gamma:: { Gamma , ChiSquared , FisherF , StudentT } ;
177
175
#[ cfg( feature="std" ) ]
@@ -215,89 +213,6 @@ mod ziggurat_tables;
215
213
#[ cfg( feature="std" ) ]
216
214
use distributions:: float:: IntoFloat ;
217
215
218
- /// Types that can be used to create a random instance of `Support`.
219
- #[ deprecated( since="0.5.0" , note="use Distribution instead" ) ]
220
- pub trait Sample < Support > {
221
- /// Generate a random value of `Support`, using `rng` as the
222
- /// source of randomness.
223
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> Support ;
224
- }
225
-
226
- /// `Sample`s that do not require keeping track of state.
227
- ///
228
- /// Since no state is recorded, each sample is (statistically)
229
- /// independent of all others, assuming the `Rng` used has this
230
- /// property.
231
- #[ allow( deprecated) ]
232
- #[ deprecated( since="0.5.0" , note="use Distribution instead" ) ]
233
- pub trait IndependentSample < Support > : Sample < Support > {
234
- /// Generate a random value.
235
- fn ind_sample < R : Rng > ( & self , & mut R ) -> Support ;
236
- }
237
-
238
- /// DEPRECATED: Use `distributions::uniform` instead.
239
- #[ deprecated( since="0.5.0" , note="use uniform instead" ) ]
240
- pub mod range {
241
- pub use distributions:: uniform:: Uniform as Range ;
242
- pub use distributions:: uniform:: SampleUniform as SampleRange ;
243
- }
244
-
245
- #[ allow( deprecated) ]
246
- mod impls {
247
- use Rng ;
248
- use distributions:: { Distribution , Sample , IndependentSample ,
249
- WeightedChoice } ;
250
- #[ cfg( feature="std" ) ]
251
- use distributions:: exponential:: Exp ;
252
- #[ cfg( feature="std" ) ]
253
- use distributions:: gamma:: { Gamma , ChiSquared , FisherF , StudentT } ;
254
- #[ cfg( feature="std" ) ]
255
- use distributions:: normal:: { Normal , LogNormal } ;
256
- use distributions:: range:: { Range , SampleRange } ;
257
-
258
- impl < ' a , T : Clone > Sample < T > for WeightedChoice < ' a , T > {
259
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> T {
260
- Distribution :: sample ( self , rng)
261
- }
262
- }
263
- impl < ' a , T : Clone > IndependentSample < T > for WeightedChoice < ' a , T > {
264
- fn ind_sample < R : Rng > ( & self , rng : & mut R ) -> T {
265
- Distribution :: sample ( self , rng)
266
- }
267
- }
268
-
269
- impl < T : SampleRange > Sample < T > for Range < T > {
270
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> T {
271
- Distribution :: sample ( self , rng)
272
- }
273
- }
274
- impl < T : SampleRange > IndependentSample < T > for Range < T > {
275
- fn ind_sample < R : Rng > ( & self , rng : & mut R ) -> T {
276
- Distribution :: sample ( self , rng)
277
- }
278
- }
279
-
280
- #[ cfg( feature="std" ) ]
281
- macro_rules! impl_f64 {
282
- ( $( $name: ident) , * ) => {
283
- $(
284
- impl Sample <f64 > for $name {
285
- fn sample<R : Rng >( & mut self , rng: & mut R ) -> f64 {
286
- Distribution :: sample( self , rng)
287
- }
288
- }
289
- impl IndependentSample <f64 > for $name {
290
- fn ind_sample<R : Rng >( & self , rng: & mut R ) -> f64 {
291
- Distribution :: sample( self , rng)
292
- }
293
- }
294
- ) *
295
- }
296
- }
297
- #[ cfg( feature="std" ) ]
298
- impl_f64 ! ( Exp , Gamma , ChiSquared , FisherF , StudentT , Normal , LogNormal ) ;
299
- }
300
-
301
216
/// Types (distributions) that can be used to create a random instance of `T`.
302
217
///
303
218
/// It is possible to sample from a distribution through both the
@@ -445,13 +360,6 @@ impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T>
445
360
#[ derive( Clone , Copy , Debug ) ]
446
361
pub struct Standard ;
447
362
448
- #[ allow( deprecated) ]
449
- impl < T > :: Rand for T where Standard : Distribution < T > {
450
- fn rand < R : Rng > ( rng : & mut R ) -> Self {
451
- Standard . sample ( rng)
452
- }
453
- }
454
-
455
363
456
364
/// A value with a particular weight for use with `WeightedChoice`.
457
365
#[ derive( Copy , Clone , Debug ) ]
@@ -637,7 +545,6 @@ fn ziggurat<R: Rng + ?Sized, P, Z>(
637
545
638
546
#[ cfg( test) ]
639
547
mod tests {
640
- use Rng ;
641
548
use rngs:: mock:: StepRng ;
642
549
use super :: { WeightedChoice , Weighted , Distribution } ;
643
550
@@ -743,31 +650,6 @@ mod tests {
743
650
Weighted { weight : 1 , item : 3 } ] ) ;
744
651
}
745
652
746
- #[ test] #[ allow( deprecated) ]
747
- fn test_backwards_compat_sample ( ) {
748
- use distributions:: { Sample , IndependentSample } ;
749
-
750
- struct Constant < T > { val : T }
751
- impl < T : Copy > Sample < T > for Constant < T > {
752
- fn sample < R : Rng > ( & mut self , _: & mut R ) -> T { self . val }
753
- }
754
- impl < T : Copy > IndependentSample < T > for Constant < T > {
755
- fn ind_sample < R : Rng > ( & self , _: & mut R ) -> T { self . val }
756
- }
757
-
758
- let mut sampler = Constant { val : 293 } ;
759
- assert_eq ! ( sampler. sample( & mut :: test:: rng( 233 ) ) , 293 ) ;
760
- assert_eq ! ( sampler. ind_sample( & mut :: test:: rng( 234 ) ) , 293 ) ;
761
- }
762
-
763
- #[ cfg( feature="std" ) ]
764
- #[ test] #[ allow( deprecated) ]
765
- fn test_backwards_compat_exp ( ) {
766
- use distributions:: { IndependentSample , Exp } ;
767
- let sampler = Exp :: new ( 1.0 ) ;
768
- sampler. ind_sample ( & mut :: test:: rng ( 235 ) ) ;
769
- }
770
-
771
653
#[ cfg( feature="std" ) ]
772
654
#[ test]
773
655
fn test_distributions_iter ( ) {
0 commit comments