diff --git a/Cargo.lock b/Cargo.lock index 865aad9..8f0f1ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -635,9 +635,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.0-alpha.1" +version = "0.9.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31e63ea85be51c423e52ba8f2e68a3efd53eed30203ee029dd09947333693e" +checksum = "c3e256ff62cee3e03def855c4d4260106d2bb1696fdc01af03e9935b993720a5" dependencies = [ "rand_chacha", "rand_core", @@ -646,9 +646,9 @@ dependencies = [ [[package]] name = "rand_chacha" -version = "0.9.0-alpha.1" +version = "0.9.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78674ef918c19451dbd250f8201f8619b494f64c9aa6f3adb28fd8a0f1f6da46" +checksum = "d299e9db34f6623b2a9e86c015d6e173d5f46d64d4b9b8cc46ae8a982a50b04c" dependencies = [ "ppv-lite86", "rand_core", @@ -656,9 +656,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.0-alpha.1" +version = "0.9.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc89dffba8377c5ec847d12bb41492bda235dba31a25e8b695cd0fe6589eb8c9" +checksum = "f4e93f5a5e3c528cda9acb0928c31b2ba868c551cc46e67b778075e34aab9906" dependencies = [ "getrandom", "zerocopy", @@ -955,18 +955,18 @@ checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" [[package]] name = "zerocopy" -version = "0.8.0-alpha.6" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db678a6ee512bd06adf35c35be471cae2f9c82a5aed2b5d15e03628c98bddd57" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.0-alpha.6" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201585ea96d37ee69f2ac769925ca57160cef31acb137c16f38b02b76f4c1e62" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 85a41c6..db4055c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ arboard = "3.1.0" assert_cmd = "2.0.16" clap = { version = "4.5.15", features = ["derive"] } lazy_static = "1.4.0" -rand = "0.9.0-alpha.1" +rand = "0.9.0-alpha.2" [profile.release] codegen-units = 1 diff --git a/src/lib.rs b/src/lib.rs index efab68e..c1499f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,7 @@ pub fn join(picked: Vec<&str>, separators: &[&str], rng: &mut R .into_iter() .map(|name| name.to_owned()) .reduce(|password, next| { - let i = rng.gen::() % separators.len(); + let i = rng.random::() as usize % separators.len(); format!("{}{}{}", password, separators[i], next) }) .unwrap_or_else(|| "".to_string()) @@ -109,7 +109,7 @@ mod test { let mut rng = rng_from_seed(POKEMON_COUNT); assert_eq!( - "Makuhita6Milotic2Shiftry7Charmander".to_string(), + "Makuhita0Milotic6Shiftry8Charmander".to_string(), generate(None, 4, "digit", &mut rng) ); } @@ -121,7 +121,7 @@ mod test { let mut rng = rng_from_seed(POKEMON_COUNT); assert_eq!( - "Makuhita]Milotic!Shiftry-Charmander".to_string(), + "Makuhita=Milotic;Shiftry]Charmander".to_string(), generate(None, 4, "special", &mut rng) ); } @@ -134,7 +134,7 @@ mod test { let picked = vec!["Lilligant", "Tranquill", "Shelmet", "Mesprit"]; assert_eq!( - "Lilligant6Tranquill2Shelmet7Mesprit", + "Lilligant0Tranquill6Shelmet8Mesprit", join(picked, DIGITS, &mut rng) ); }