Skip to content

Commit

Permalink
rand 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay committed Feb 2, 2025
1 parent c659423 commit 5c29065
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 16 deletions.
113 changes: 100 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ chrono = "0.4.39"
clap = { version = "4.5.27", features = ["cargo"] }
indicatif = "0.17.11"
thiserror = "2.0.11"
rand = "0.8.5"
rand = "0.9.0"
4 changes: 2 additions & 2 deletions src/user_agents.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rand::seq::SliceRandom;
use rand::seq::IndexedRandom;

const USER_AGENTS: [&str; 16] = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36",
Expand Down Expand Up @@ -26,7 +26,7 @@ pub enum UserAgent {
}

pub fn random_user_agent() -> String {
let ua = USER_AGENTS.choose(&mut rand::thread_rng());
let ua = USER_AGENTS.choose(&mut rand::rng());
// safe unwrap because the array is not empty
(*ua.unwrap()).to_string()
}
Expand Down

0 comments on commit 5c29065

Please sign in to comment.