The following is a simple, portable (R5RS) generator of pseudo-random integers in Scheme. Chapter 7 of Numerical Recipes presents
it as the "fast" linear congruential pseudo-random number
generator (`ranqd1'). Please read the description of the
algorithm and learn about its limitations before using this routine for any
serious purpose.
Here is the code: