Skip to content

Commit

Permalink
Fix use of rand for breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbhannah committed Aug 15, 2024
1 parent d98b227 commit 4a920f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn join<R: Rng + ?Sized>(picked: Vec<&str>, separators: &[&str], rng: &mut R
.into_iter()
.map(|name| name.to_owned())
.reduce(|password, next| {
let i = rng.gen::<usize>() % separators.len();
let i = rng.random::<u32>() as usize % separators.len();
format!("{}{}{}", password, separators[i], next)
})
.unwrap_or_else(|| "".to_string())
Expand Down Expand Up @@ -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)
);
}
Expand All @@ -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)
);
}
Expand All @@ -134,7 +134,7 @@ mod test {
let picked = vec!["Lilligant", "Tranquill", "Shelmet", "Mesprit"];

assert_eq!(
"Lilligant6Tranquill2Shelmet7Mesprit",
"Lilligant0Tranquill6Shelmet8Mesprit",
join(picked, DIGITS, &mut rng)
);
}
Expand Down

0 comments on commit 4a920f2

Please sign in to comment.