We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1636078 commit f6e1f5fCopy full SHA for f6e1f5f
src/oid.rs
@@ -153,10 +153,16 @@ impl ObjectId {
153
154
// Generate a random 5-byte array.
155
fn gen_process_id() -> [u8; 5] {
156
- let rng = thread_rng().gen_range(0, MAX_U24) as u32;
157
- let mut buf: [u8; 5] = [0; 5];
158
- buf[0..4].copy_from_slice(&rng.to_be_bytes());
159
- buf
+ lazy_static! {
+ static ref BUF: [u8; 5] = {
+ let rng = thread_rng().gen_range(0, MAX_U24) as u32;
+ let mut buf: [u8; 5] = [0; 5];
160
+ buf[0..4].copy_from_slice(&rng.to_be_bytes());
161
+ buf
162
+ };
163
+ }
164
+
165
+ *BUF
166
}
167
168
// Gets an incremental 3-byte count.
0 commit comments