drand48 0.2.0

drand48 - POSIX.1 standard LCG random number generator
Documentation
/*
DRAND48 Linear congruential generator
implementation by Radim Kolar <hsn@sendmail.cz> 2025
https://gitlab.com/hsn10/drand48

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/>
*/

#![allow(non_snake_case)]

use super::validate_seed;
use super::M;

fn clamp_to_valid( seed: i64 ) -> bool {
   validate_seed( super::clamp_seed(seed) )
}

#[test]
fn is_zero() {
   assert! ( clamp_to_valid(0) );
}

#[test]
fn is_minus_1() {
   assert! ( clamp_to_valid(-1) );
}

#[test]
fn is_M() {
   assert! ( clamp_to_valid(M) );
}

#[test]
fn is_M_plus_1() {
   assert! ( clamp_to_valid(M+1) );
}

#[test]
fn is_50() {
   assert! ( clamp_to_valid(50) );
}