minstd 0.9.4

MINSTD minimal standard random number generator
Documentation
/*
MINSTD Multiplicative congruential generator
implementation by Radim Kolar <hsn@sendmail.cz> 2024
https://gitlab.com/hsn10/minstd

This is free and unencumbered software released into the public domain.
SPDX-License-Identifier: Unlicense OR CC0-1.0

For more information, please refer to <http://unlicense.org/>
*/

use super::clamp_seed;
use super::M;

#[test]
fn clamp_zero() {
   assert_eq! ( clamp_seed(0), 1 )
}

#[test]
fn clamp_negative() {
   assert_eq! ( clamp_seed(-50), 50 )
}

#[test]
fn is_M() {
   assert_eq! ( clamp_seed(M), M - 1 )
}

#[test]
fn is_neg_M() {
   assert_eq! ( clamp_seed(-2147483647), M - 1 )
}

#[test]
fn noclamp_50() {
   assert_eq! ( clamp_seed(50), 50 )
}