home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / autocad / random.arj / READ.ME < prev   
Lisp/Scheme  |  1991-08-28  |  2KB  |  47 lines

  1. LRAND
  2.    28 August, 1991
  3.  
  4.    This is an ADS routine to generate random numbers between 0.0 and 1.0.  It
  5.  was written using Metaware High C v1.71 and linked with Pharlap DOS-Extender
  6.  v4.0.
  7.      There isn't any 'cool' stuff going on here.  The program converts the
  8.  native random number generator supplied with High C into a real number
  9.  between 0 and 1.  The generator should have a period of 2^32.  I have not
  10.  tested the true "randomness" of this function, and thus cannot and do not
  11.  make any claims for suitability for anything.
  12.    This routine is supplied for public consumption.  If you have any questions
  13.  feel free to contact me at the address below, or CI$.
  14.  
  15.    To use, from the AutoCAD drawing editor type:
  16.  
  17.    (xload"lrand")<CR>
  18.  
  19.    After that, the function "rand" is available for use usng the standard
  20.    AutoLISP format:
  21.  
  22.    (rand)
  23.  
  24.    It will return  pseudo-random number between 0 and 1.  The return number is
  25.    NOT a list, just a real number, so a function to return a random integer
  26.    less than an arbitrary integer i might look like:
  27.  
  28.    (defun iran( / i)
  29.      (fix (* (rand) i))
  30.    )
  31.  
  32.    If any peculiar distributions are required, they can easily be implented in
  33.    LISP using this as a basis.  ADS would be faster though.  If there is any
  34.    interest in other distributions, contact me and convince me I need to write
  35.    them.... (got any money? .. can I have some???   <grin>  special, this week
  36.    only....!!)
  37.  
  38.  
  39.  
  40. Clayton L. Cranor  (CI$ 71121,773)
  41. Denali Computing Services
  42. 3520 International Way
  43. Fairbanks, Alaska 99701
  44. (907)451-5003
  45.  
  46.  
  47.