Skip to content

Commit f5ca3b2

Browse files
committed
fix: update examples for new rand version
1 parent d20af11 commit f5ca3b2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ use challenge_response::hmacmode::{
121121
HmacKey, HmacSecret, HMAC_SECRET_SIZE,
122122
};
123123
use challenge_response::ChallengeResponse;
124-
use rand::distributions::Alphanumeric;
125-
use rand::{thread_rng, Rng};
124+
use rand::distr::Alphanumeric;
125+
use rand::{rng, Rng};
126126
127127
fn main() {
128128
let mut cr_client = match ChallengeResponse::new() {
@@ -149,7 +149,7 @@ fn main() {
149149
let config = Config::new_from(device)
150150
.set_command(Command::Configuration2);
151151
152-
let mut rng = thread_rng();
152+
let mut rng = rng();
153153
154154
// Used rand here, but you can set your own secret:
155155
// let secret: &HmacSecret = b"my_awesome_secret_20";

examples/configuration_hmac.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use challenge_response::config::{Command, Config};
55
use challenge_response::configure::DeviceModeConfig;
66
use challenge_response::hmacmode::HmacKey;
77
use challenge_response::ChallengeResponse;
8-
use rand::distributions::Alphanumeric;
9-
use rand::{thread_rng, Rng};
8+
use rand::distr::Alphanumeric;
9+
use rand::{rng, Rng};
1010

1111
fn main() {
1212
let mut challenge_response = ChallengeResponse::new().unwrap();
@@ -19,7 +19,7 @@ fn main() {
1919

2020
let config = Config::new_from(device).set_command(Command::Configuration2);
2121

22-
let rng = thread_rng();
22+
let rng = rng();
2323

2424
let require_press_button = false;
2525

0 commit comments

Comments
 (0)