randomize 2.1.0

A dead simple to use randomization library for rust.
#![feature(test)]

extern crate test;
use test::Bencher;

use randomize::{lcg::*, *};
use std::time::{SystemTime, UNIX_EPOCH};

pub fn u64_from_time() -> u64 {
  let unix_delta = match SystemTime::now().duration_since(UNIX_EPOCH) {
    Ok(duration) => duration,
    Err(system_time_error) => system_time_error.duration(),
  };
  if unix_delta.subsec_nanos() != 0 {
    unix_delta.as_secs().wrapping_mul(unix_delta.subsec_nanos() as u64)
  } else {
    unix_delta.as_secs()
  }
}

#[bench]
fn bench_lcg8(b: &mut Bencher) {
  let mut state = u64_from_time() as u8;
  b.iter(|| state = lcg8(state, PCG_DEFAULT_MULTIPLIER_8, PCG_DEFAULT_INCREMENT_8));
}

#[bench]
fn bench_lcg16(b: &mut Bencher) {
  let mut state = u64_from_time() as u16;
  b.iter(|| state = lcg16(state, PCG_DEFAULT_MULTIPLIER_16, PCG_DEFAULT_INCREMENT_16));
}

#[bench]
fn bench_lcg32(b: &mut Bencher) {
  let mut state = u64_from_time() as u32;
  b.iter(|| state = lcg32(state, PCG_DEFAULT_MULTIPLIER_32, PCG_DEFAULT_INCREMENT_32));
}

#[bench]
fn bench_lcg64(b: &mut Bencher) {
  let mut state = u64_from_time();
  b.iter(|| state = lcg64(state, PCG_DEFAULT_MULTIPLIER_64, PCG_DEFAULT_INCREMENT_64));
}

#[bench]
fn bench_lcg128(b: &mut Bencher) {
  let mut state = ((u64_from_time() as u128) << 64) | (u64_from_time() as u128);
  b.iter(|| state = lcg128(state, PCG_DEFAULT_MULTIPLIER_128, PCG_DEFAULT_INCREMENT_128));
}