use rand_core::OsRng; use rand_core::RngCore; use rand_chacha::ChaCha8Rng; use rand_chacha::rand_core::SeedableRng; fn main(){ let mut random = ChaCha8Rng::seed_from_u64(OsRng.next_u64()); let mut u128_pool = [0u8; 16]; random.fill_bytes(&mut u128_pool); let session_token = u128::from_le_bytes(u128_pool); println!("{:?}", session_token); }
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/sample`
68291255163114295989027254289217915346
いまいち意味わかってないけどすげえ…