use std::time::{SystemTime, UNIX_EPOCH};
fn current_time() -> u128 {
let now = SystemTime::now();
let nanos = now.duration_since(UNIX_EPOCH)
.expect("time went backwards")
.as_nanos();
return nanos;
}
fn scramble(mut n: u128) -> u128 {
n ^= 0xDEADBEEF;
n <<= 0xF;
n ^= 0xCAFEBEEF;
n ^= 0xBEEF;
n |= 0xCAFE;
n >>= 0xF;
n ^= 0xBEEFDEAD;
n <<= 20;
n ^= 0xBEEFDDDD;
n <<= 20;
n ^= 0xB4DD1E;
n |= 0xC0DE;
n
}
pub fn get_uuid() -> u128 {
let mut random = current_time();
random = scramble(random);
return random;
}