File tree 1 file changed +3
-3
lines changed 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
use futures:: Stream ;
5
5
use pin_project:: pin_project;
6
- use rand:: { rngs:: SmallRng , thread_rng , SeedableRng } ;
6
+ use rand:: { rngs:: SmallRng , SeedableRng } ;
7
7
use std:: future:: Future ;
8
8
use std:: pin:: Pin ;
9
9
use std:: task:: { Context , Poll } ;
@@ -74,7 +74,7 @@ impl ExponentialBackoff {
74
74
pub fn stream ( & self ) -> ExponentialBackoffStream {
75
75
ExponentialBackoffStream {
76
76
backoff : * self ,
77
- rng : SmallRng :: from_rng ( & mut thread_rng ( ) ) . expect ( "RNG must be valid" ) ,
77
+ rng : SmallRng :: from_rng ( & mut rand :: rng ( ) ) ,
78
78
iterations : 0 ,
79
79
sleeping : false ,
80
80
sleep : Box :: pin ( time:: sleep ( time:: Duration :: from_secs ( 0 ) ) ) ,
@@ -103,7 +103,7 @@ impl ExponentialBackoff {
103
103
if self . jitter == 0.0 {
104
104
time:: Duration :: default ( )
105
105
} else {
106
- let jitter_factor = rng. gen :: < f64 > ( ) ;
106
+ let jitter_factor = rng. random :: < f64 > ( ) ;
107
107
debug_assert ! (
108
108
jitter_factor > 0.0 ,
109
109
"rng returns values between 0.0 and 1.0"
You can’t perform that action at this time.
0 commit comments