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_upper_case_globals)]

const lrand48_numbers: [i32; 40] = [
    809656496,
    1319053329,
    1231709009,
    534985621,
    1888249275,
    531838155,
    1985161880,
    1729919867,
    30243789,
    470019732,
    1811756510,
    1234081616,
    469419974,
    2023778756,
    1794709608,
    1671239490,
    1127948646,
    304349425,
    1387437743,
    180273209,
    1941428956,
    1192838834,
    496896504,
    1313099882,
    1983788781,
    1805324670,
    1036987281,
    194851593,
    1057609661,
    1397171122,
    2048178601,
    1714322715,
    1225461822,
    1426854321,
    750639053,
    377726313,
    33595954,
    1343498277,
    1733651707,
    1550158224,
];

#[test]
fn lrand_srand48_minus() {
   let mut g = super::srand48(-1234567);
   for i in 0..lrand48_numbers.len() {
      assert_eq!(g.lrand48(), lrand48_numbers[i], "array item no. {} failed", i);
   }
}