Skip to content

Commit f2cd720

Browse files
authored
minor: use random() directly in gen_process_id (#438)
1 parent a73ee9d commit f2cd720

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/oid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime};
1414

1515
use hex::{self, FromHexError};
1616
use once_cell::sync::Lazy;
17-
use rand::{thread_rng, Rng};
17+
use rand::{random, thread_rng, Rng};
1818

1919
const TIMESTAMP_SIZE: usize = 4;
2020
const PROCESS_ID_SIZE: usize = 5;
@@ -253,7 +253,7 @@ impl ObjectId {
253253

254254
/// Generate a random 5-byte array.
255255
fn gen_process_id() -> [u8; 5] {
256-
static BUF: Lazy<[u8; 5]> = Lazy::new(|| thread_rng().gen());
256+
static BUF: Lazy<[u8; 5]> = Lazy::new(random);
257257

258258
*BUF
259259
}

0 commit comments

Comments
 (0)