/*
   Random number module for Guile.
   Random numbers are generated using the  kernel's  random(4)
   number generator. Longs and shorts can be generated,
   signed and unsigned.

   Usage:
   (gs-random[u]l [<count>])
        - generate <count> [un]signed longs using /dev/random
   (gs-urandom[u]l [<count>])
        - generate <count> [un]signed longs using /dev/urandom
   (gs-random[u]s [<count>])
        - generate <count> [un]signed shorts using /dev/random
   (gs-urandom[u]s [<count>])
        - generate <count> [un]signed shorts using /dev/urandom

   (gs-srandom)
        - return a pseudo-random number using srandom(3) and time(NULL).
   (gs-srandom <anything>)
        - return a pseudo-random number using srandom(3) and gettimeofday.tv_usec.
   
   <count> defaults to 2.

   NOTE:
        According to random(4), calls to /dev/random will block
        while entropy pool is empty. gs-randomXX do indeed block,
        sometimes for very long periods!
   
   One probably really doesn't need to generate short integers; one
   may generate longs and then modulo (1<<sizeof(short)) to
   get short ints. Or not...

   Examples:
   (use-modules (math random))
   (gs-urandomul 5)
   ==> (309740961 1108058718 969750695 3167338387 441269510)
   (gs-randoml)
   ==> (415662357 76787305 -523869225 -2044569091 -852185446)
   (gs-urandoms 5)
   ==> (16635 -9747 21831 19282 9873)
   (gs-randomus)
   ==> (13218 430)

   Compiling:
   gcc -Wall -fPIC -shared -o librandom.so random.c
   mkdir -p  ~/.sula/trill/math
   cp librandom.so ~/.sula/trill/math

   Don't forget to modify %load-path so that Guile can find the
   module.

   See the GNU GPL for blabla.

   fotang@yahoo.com, 3/99.
   http://members.xoom.com/sprimerix/download.

 */
      --EOF-
