uuid/v4.rs
1use crate::Uuid;
2
3impl Uuid {
4 pub fn new_v4() -> Uuid {
5 return Uuid::from_u128(rand::random::<u128>() & 0xFFFFFFFFFFFF4FFFBFFFFFFFFFFFFFFF | 0x40008000000000000000);
6 // let mut uuid = Uuid(rand::random());
7
8 // // Version: V4. 4 << 4 = 0x40
9 // uuid.0[6] = (uuid.0[6] & 0x0f) | ((Version::V4 as u8) << 4);
10 // // Variant: RFC4122
11 // uuid.0[8] = (uuid.0[8] & 0x3f) | 0x80;
12
13 // return uuid;
14 }
15}