randomize 2.1.0

A dead simple to use randomization library for rust.
#[macro_use]
extern crate proptest;

use randomize::{lcg::*, *};

proptest! {
  #[test]
  fn prop_for_jump_lcg8(s in 0..=core::u8::MAX, j in 0..=core::u8::MAX) {
    // go the slow route
    let mut s_slow: u8 = s;
    for _ in 0 .. j {
      s_slow = lcg8(s_slow, PCG_DEFAULT_MULTIPLIER_8, PCG_DEFAULT_INCREMENT_8);
    }
    // go the fast route
    let s_jumped: u8 = jump_lcg8(j, s, PCG_DEFAULT_MULTIPLIER_8, PCG_DEFAULT_INCREMENT_8);
    // compare
    prop_assert_eq!(s_jumped, s_slow);
  }
}

proptest! {
  #[test]
  fn prop_for_jump_lcg16(s in 0..=core::u16::MAX, j in 0..=core::u16::MAX) {
    // go the slow route
    let mut s_slow: u16 = s;
    for _ in 0 .. j {
      s_slow = lcg16(s_slow, PCG_DEFAULT_MULTIPLIER_16, PCG_DEFAULT_INCREMENT_16);
    }
    // go the fast route
    let s_jumped: u16 = jump_lcg16(j, s, PCG_DEFAULT_MULTIPLIER_16, PCG_DEFAULT_INCREMENT_16);
    // compare
    prop_assert_eq!(s_jumped, s_slow);
  }
}

proptest! {
  #[test]
  fn prop_for_jump_lcg32(s in 0..=core::u32::MAX, j in 0..=core::u16::MAX) {
    // Note(Lokathor): Yes, `j` is supposed to be only up to `u16`, or the test
    // ends up taking way too long to run

    // go the slow route
    let mut s_slow: u32 = s;
    for _ in 0 .. j {
      s_slow = lcg32(s_slow, PCG_DEFAULT_MULTIPLIER_32, PCG_DEFAULT_INCREMENT_32);
    }
    // go the fast route
    let s_jumped: u32 = jump_lcg32(j as u32, s, PCG_DEFAULT_MULTIPLIER_32, PCG_DEFAULT_INCREMENT_32);
    // compare
    prop_assert_eq!(s_jumped, s_slow);
  }
}

proptest! {
  #[test]
  fn prop_for_jump_lcg64(s in 0..=core::u64::MAX, j in 0..=core::u16::MAX) {
    // Note(Lokathor): Yes, `j` is supposed to be only up to `u16`, or the test
    // ends up taking way too long to run

    // go the slow route
    let mut s_slow: u64 = s;
    for _ in 0 .. j {
      s_slow = lcg64(s_slow, PCG_DEFAULT_MULTIPLIER_64, PCG_DEFAULT_INCREMENT_64);
    }
    // go the fast route
    let s_jumped: u64 = jump_lcg64(j as u64, s, PCG_DEFAULT_MULTIPLIER_64, PCG_DEFAULT_INCREMENT_64);
    // compare
    prop_assert_eq!(s_jumped, s_slow);
  }
}

proptest! {
  #[test]
  fn prop_for_jump_lcg128(s in 0..=core::u128::MAX, j in 0..=core::u16::MAX) {
    // Note(Lokathor): Yes, `j` is supposed to be only up to `u16`, or the test
    // ends up taking way too long to run

    // go the slow route
    let mut s_slow: u128 = s;
    for _ in 0 .. j {
      s_slow = lcg128(s_slow, PCG_DEFAULT_MULTIPLIER_128, PCG_DEFAULT_INCREMENT_128);
    }
    // go the fast route
    let s_jumped: u128 = jump_lcg128(j as u128, s, PCG_DEFAULT_MULTIPLIER_128, PCG_DEFAULT_INCREMENT_128);
    // compare
    prop_assert_eq!(s_jumped, s_slow);
  }
}