make-cmwc-gen
make-default-cmwc-gen
make-cmwc-gen-raw
init-cmwc-seed
Version: 5.2

Complementary Multiply-With-Carry Psuedo-Random Number Generator

 (require (planet djhaskin987/cmwc:1:0))
Provides functions which construct generators for random numbers using the complementary multiply-with-carry method.
(make-cmwc-gen seed a b c)  (and/c generator? (-> integer?))
  seed : (listof integer?)
  a : integer?
  b : integer?
  c : integer?
Given a seed list, a multiplier a, a modulus b, and an initial carry value c, makes and returns a random number generator.
(make-default-cmwc-gen init-seed)
  (and/c generator? (-> integer?))
  init-seed : integer?
Makes the default generator whose seed is generated by init-cmwc-seed, and whose a, b and initial c is carefully chosen to give a lag of 4096, a period of 2^131104 and which yields numbers in the range of 0-4,294,967,295.
(make-cmwc-gen-raw raw-seed a b c)
  (and/c generator? (-> integer?))
  raw-seed : queue?
  a : integer?
  b : integer?
  c : integer?
Makes a generator using a raw seed, or a seed in queue form rather than list form.
(init-cmwc-seed init-seed lag)  queue?
  init-seed : integer?
  lag : integer?
Yields a raw cmwc seed based on an initial integer init-seed whose length (number of integers in the seed) is lag.