dandelion-random 0.3.0

a high performance non-cryptographic random number generator
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Writes random bytes to stdout.

use dandelion::Rng;
use std::io::Write;
use std::io::stdout;
use std::mem::MaybeUninit;
use std::num::NonZeroU128;

fn main() {
  let mut rng = Rng::new(NonZeroU128::MIN);
  let mut buf = [MaybeUninit::uninit(); 1 << 16];
  let mut out = stdout().lock();

  loop {
    let buf = rng.fill_uninit(&mut buf);
    if let Err(_) = out.write_all(buf) { break }
  }
}