Info-Mac Archive Downloads: dev/lib/

Back to dev/lib/

RandomNumberLib (random-number-lib.hqx)

Download random-number-lib.hqx (17,137 KB)


From: Michael P. McLaughlin, mpmcl@mitre.org
Subject: RandomNumberLib

UltraLibU -- A pseudo-random-number library for Macintosh platforms

This library is a new C/Assembly implementation of the Ultra PRNG developed
by Marsaglia, et al. (see leading reference in source). It is designed
primarily for Macintosh platforms and replaces an earlier (non-PPC)
library, by this author, that is currently available in a number of public
archives.

UltraLibU contains one low-level assembly routine, in a
conditional-compilation block, for MC68020 (and higher) or PowerPC
processors. (Note: Pure C source for this routine is already available in
the usual Internet archives.) The assembly syntax is that of Metrowerks'
CodeWarrior but adaptation to other compilers should be trivial.

The library contains 14 functions returning random numbers in various
formats, from Booleans to Gaussians, as well as ancillary functions to
initialize the PRNG and to save/restore its context (to reproduce a
sequence exactly).

This PRNG is HIGHLY RANDOM, even at the bit level, VERY FAST and has an
extremely long period (> 10^356).