@@ -167,8 +167,6 @@ use Rng;
167
167
#[ doc( inline) ] pub use self :: other:: Alphanumeric ;
168
168
#[ doc( inline) ] pub use self :: uniform:: Uniform ;
169
169
#[ doc( inline) ] pub use self :: float:: { OpenClosed01 , Open01 } ;
170
- #[ deprecated( since="0.5.0" , note="use Uniform instead" ) ]
171
- pub use self :: uniform:: Uniform as Range ;
172
170
#[ cfg( feature="std" ) ]
173
171
#[ doc( inline) ] pub use self :: gamma:: { Gamma , ChiSquared , FisherF , StudentT } ;
174
172
#[ cfg( feature="std" ) ]
@@ -204,89 +202,6 @@ mod ziggurat_tables;
204
202
#[ cfg( feature="std" ) ]
205
203
use distributions:: float:: IntoFloat ;
206
204
207
- /// Types that can be used to create a random instance of `Support`.
208
- #[ deprecated( since="0.5.0" , note="use Distribution instead" ) ]
209
- pub trait Sample < Support > {
210
- /// Generate a random value of `Support`, using `rng` as the
211
- /// source of randomness.
212
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> Support ;
213
- }
214
-
215
- /// `Sample`s that do not require keeping track of state.
216
- ///
217
- /// Since no state is recorded, each sample is (statistically)
218
- /// independent of all others, assuming the `Rng` used has this
219
- /// property.
220
- #[ allow( deprecated) ]
221
- #[ deprecated( since="0.5.0" , note="use Distribution instead" ) ]
222
- pub trait IndependentSample < Support > : Sample < Support > {
223
- /// Generate a random value.
224
- fn ind_sample < R : Rng > ( & self , & mut R ) -> Support ;
225
- }
226
-
227
- /// DEPRECATED: Use `distributions::uniform` instead.
228
- #[ deprecated( since="0.5.0" , note="use uniform instead" ) ]
229
- pub mod range {
230
- pub use distributions:: uniform:: Uniform as Range ;
231
- pub use distributions:: uniform:: SampleUniform as SampleRange ;
232
- }
233
-
234
- #[ allow( deprecated) ]
235
- mod impls {
236
- use Rng ;
237
- use distributions:: { Distribution , Sample , IndependentSample ,
238
- WeightedChoice } ;
239
- #[ cfg( feature="std" ) ]
240
- use distributions:: exponential:: Exp ;
241
- #[ cfg( feature="std" ) ]
242
- use distributions:: gamma:: { Gamma , ChiSquared , FisherF , StudentT } ;
243
- #[ cfg( feature="std" ) ]
244
- use distributions:: normal:: { Normal , LogNormal } ;
245
- use distributions:: range:: { Range , SampleRange } ;
246
-
247
- impl < ' a , T : Clone > Sample < T > for WeightedChoice < ' a , T > {
248
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> T {
249
- Distribution :: sample ( self , rng)
250
- }
251
- }
252
- impl < ' a , T : Clone > IndependentSample < T > for WeightedChoice < ' a , T > {
253
- fn ind_sample < R : Rng > ( & self , rng : & mut R ) -> T {
254
- Distribution :: sample ( self , rng)
255
- }
256
- }
257
-
258
- impl < T : SampleRange > Sample < T > for Range < T > {
259
- fn sample < R : Rng > ( & mut self , rng : & mut R ) -> T {
260
- Distribution :: sample ( self , rng)
261
- }
262
- }
263
- impl < T : SampleRange > IndependentSample < T > for Range < T > {
264
- fn ind_sample < R : Rng > ( & self , rng : & mut R ) -> T {
265
- Distribution :: sample ( self , rng)
266
- }
267
- }
268
-
269
- #[ cfg( feature="std" ) ]
270
- macro_rules! impl_f64 {
271
- ( $( $name: ident) , * ) => {
272
- $(
273
- impl Sample <f64 > for $name {
274
- fn sample<R : Rng >( & mut self , rng: & mut R ) -> f64 {
275
- Distribution :: sample( self , rng)
276
- }
277
- }
278
- impl IndependentSample <f64 > for $name {
279
- fn ind_sample<R : Rng >( & self , rng: & mut R ) -> f64 {
280
- Distribution :: sample( self , rng)
281
- }
282
- }
283
- ) *
284
- }
285
- }
286
- #[ cfg( feature="std" ) ]
287
- impl_f64 ! ( Exp , Gamma , ChiSquared , FisherF , StudentT , Normal , LogNormal ) ;
288
- }
289
-
290
205
/// Types (distributions) that can be used to create a random instance of `T`.
291
206
///
292
207
/// It is possible to sample from a distribution through both the
@@ -434,13 +349,6 @@ impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T>
434
349
#[ derive( Clone , Copy , Debug ) ]
435
350
pub struct Standard ;
436
351
437
- #[ allow( deprecated) ]
438
- impl < T > :: Rand for T where Standard : Distribution < T > {
439
- fn rand < R : Rng > ( rng : & mut R ) -> Self {
440
- Standard . sample ( rng)
441
- }
442
- }
443
-
444
352
445
353
/// A value with a particular weight for use with `WeightedChoice`.
446
354
#[ derive( Copy , Clone , Debug ) ]
@@ -626,7 +534,6 @@ fn ziggurat<R: Rng + ?Sized, P, Z>(
626
534
627
535
#[ cfg( test) ]
628
536
mod tests {
629
- use Rng ;
630
537
use rngs:: mock:: StepRng ;
631
538
use super :: { WeightedChoice , Weighted , Distribution } ;
632
539
@@ -732,31 +639,6 @@ mod tests {
732
639
Weighted { weight : 1 , item : 3 } ] ) ;
733
640
}
734
641
735
- #[ test] #[ allow( deprecated) ]
736
- fn test_backwards_compat_sample ( ) {
737
- use distributions:: { Sample , IndependentSample } ;
738
-
739
- struct Constant < T > { val : T }
740
- impl < T : Copy > Sample < T > for Constant < T > {
741
- fn sample < R : Rng > ( & mut self , _: & mut R ) -> T { self . val }
742
- }
743
- impl < T : Copy > IndependentSample < T > for Constant < T > {
744
- fn ind_sample < R : Rng > ( & self , _: & mut R ) -> T { self . val }
745
- }
746
-
747
- let mut sampler = Constant { val : 293 } ;
748
- assert_eq ! ( sampler. sample( & mut :: test:: rng( 233 ) ) , 293 ) ;
749
- assert_eq ! ( sampler. ind_sample( & mut :: test:: rng( 234 ) ) , 293 ) ;
750
- }
751
-
752
- #[ cfg( feature="std" ) ]
753
- #[ test] #[ allow( deprecated) ]
754
- fn test_backwards_compat_exp ( ) {
755
- use distributions:: { IndependentSample , Exp } ;
756
- let sampler = Exp :: new ( 1.0 ) ;
757
- sampler. ind_sample ( & mut :: test:: rng ( 235 ) ) ;
758
- }
759
-
760
642
#[ cfg( feature="std" ) ]
761
643
#[ test]
762
644
fn test_distributions_iter ( ) {
0 commit comments