File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -85,12 +85,13 @@ impl Subscription {
8585 Second result will be an error."
8686 ) ]
8787 async fn random_human ( context : & Database ) -> RandomHumanStream {
88+ use rand:: { rngs:: StdRng , Rng as _, SeedableRng as _} ;
89+
8890 let mut counter = 0 ;
8991
9092 let context = ( * context) . clone ( ) ;
9193
92- use rand:: { rngs:: StdRng , Rng , SeedableRng } ;
93- let mut rng = StdRng :: from_entropy ( ) ;
94+ let mut rng = StdRng :: from_os_rng ( ) ;
9495 let mut interval = tokio:: time:: interval ( Duration :: from_secs ( 5 ) ) ;
9596 let stream = async_stream:: stream! {
9697 counter += 1 ;
@@ -102,7 +103,7 @@ impl Subscription {
102103 graphql_value!( "some additional string" ) ,
103104 ) )
104105 } else {
105- let random_id = rng. gen_range ( 1000 ..1005 ) . to_string( ) ;
106+ let random_id = rng. random_range ( 1000 ..1005 ) . to_string( ) ;
106107 let human = context. get_human( & random_id) . unwrap( ) . clone( ) ;
107108
108109 yield Ok ( RandomHuman {
You can’t perform that action at this time.
0 commit comments