diff --git a/juniper_actix/Cargo.toml b/juniper_actix/Cargo.toml index da7c5d3f2..4a5442a14 100644 --- a/juniper_actix/Cargo.toml +++ b/juniper_actix/Cargo.toml @@ -45,7 +45,7 @@ bytes = "1.0" env_logger = "0.11" juniper = { version = "0.16", path = "../juniper", features = ["expose-test-schema"] } log = "0.4" -rand = "0.8" +rand = "0.9" tokio = "1.0" [[example]] diff --git a/juniper_actix/examples/subscription.rs b/juniper_actix/examples/subscription.rs index 17f72d40f..7c3cf0248 100644 --- a/juniper_actix/examples/subscription.rs +++ b/juniper_actix/examples/subscription.rs @@ -85,12 +85,13 @@ impl Subscription { Second result will be an error." )] async fn random_human(context: &Database) -> RandomHumanStream { + use rand::{rngs::StdRng, Rng as _, SeedableRng as _}; + let mut counter = 0; let context = (*context).clone(); - use rand::{rngs::StdRng, Rng, SeedableRng}; - let mut rng = StdRng::from_entropy(); + let mut rng = StdRng::from_os_rng(); let mut interval = tokio::time::interval(Duration::from_secs(5)); let stream = async_stream::stream! { counter += 1; @@ -102,7 +103,7 @@ impl Subscription { graphql_value!("some additional string"), )) } else { - let random_id = rng.gen_range(1000..1005).to_string(); + let random_id = rng.random_range(1000..1005).to_string(); let human = context.get_human(&random_id).unwrap().clone(); yield Ok(RandomHuman {