home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
autocad
/
random.arj
/
READ.ME
< prev
Wrap
Lisp/Scheme
|
1991-08-28
|
2KB
|
47 lines
LRAND
28 August, 1991
This is an ADS routine to generate random numbers between 0.0 and 1.0. It
was written using Metaware High C v1.71 and linked with Pharlap DOS-Extender
v4.0.
There isn't any 'cool' stuff going on here. The program converts the
native random number generator supplied with High C into a real number
between 0 and 1. The generator should have a period of 2^32. I have not
tested the true "randomness" of this function, and thus cannot and do not
make any claims for suitability for anything.
This routine is supplied for public consumption. If you have any questions
feel free to contact me at the address below, or CI$.
To use, from the AutoCAD drawing editor type:
(xload"lrand")<CR>
After that, the function "rand" is available for use usng the standard
AutoLISP format:
(rand)
It will return pseudo-random number between 0 and 1. The return number is
NOT a list, just a real number, so a function to return a random integer
less than an arbitrary integer i might look like:
(defun iran( / i)
(fix (* (rand) i))
)
If any peculiar distributions are required, they can easily be implented in
LISP using this as a basis. ADS would be faster though. If there is any
interest in other distributions, contact me and convince me I need to write
them.... (got any money? .. can I have some??? <grin> special, this week
only....!!)
Clayton L. Cranor (CI$ 71121,773)
Denali Computing Services
3520 International Way
Fairbanks, Alaska 99701
(907)451-5003