Skip to content

Commit

Permalink
minor: use random() directly in gen_process_id (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdeva authored Nov 7, 2023
1 parent a73ee9d commit f2cd720
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/oid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::{convert::TryInto, time::SystemTime};

use hex::{self, FromHexError};
use once_cell::sync::Lazy;
use rand::{thread_rng, Rng};
use rand::{random, thread_rng, Rng};

const TIMESTAMP_SIZE: usize = 4;
const PROCESS_ID_SIZE: usize = 5;
Expand Down Expand Up @@ -253,7 +253,7 @@ impl ObjectId {

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

*BUF
}
Expand Down

0 comments on commit f2cd720

Please sign in to comment.