brucemount wrote:
> I recently wrote a genetic algorithm program and had great difficulty
> with the pseudo-random number generators supplied with various Eiffel
> libraries (they were not very random at all which was causing problems).
As with all pseudorandom generators, their effectiveness depends on
what you want to do.
The pseudorandom number generator provided in the class RANDOM is the
Minimal Standard Number Generator discussed in Park and Miller,
"Random number generators: good ones are hard to find", CACM, Vol 31,
pp 1192-1201, 1988.
The generating function is f(z) = 7^5*z mod (2^31 -1)
This is full period, passes a number of tests for randomness and can
be implemented efficiently. As the paper suggests, this generating
function is often a good choice.
The function rand() referred to on www.random.org and used in Windows
libraries, may be the same generator with bad choices of modulus and
multiplier.
I don't know about 64 (or 63) bit cases. But I would be cautious. Note
that 2^63 - 1 is not a prime number as 2^31 - 1 is. So, using this
modulus may exhibit periodicities in the sequence.
See also
http://members.cox.net/srice1/random/additive.html for a
64-bit Additive Random Number Generator.
> So, I wrote a class that produces random numbers from the (far more
> random) files created by Random.org. It is not as fast or convenient
> as the pseudo-random number generators (e.g., you need to download
> random.org files), but it does produce a perfectly even distribution
> (over enough trials).
>
> Would anyone else find this class helpful? (If so, I'd have to clear
> it up a bit before submitting it.) Do other people do simulations or
> genetic algorithm optimization using Eiffel?
If people need a True Random Number Generator, this would be a useful
resource. I have not been using Random number generators in my current
work, but it is useful to know about your material.
If you have not already done so, and if it is possible, I suggest
using the interface of RANDOM for your class, so that it could be a
"drop in" replacement for RANDOM.
--
Peter Horan Faculty of Science and Technology
peter@... Deakin University
+61-4-0831 2116 (Voice) Geelong, Victoria 3217, AUSTRALIA
+61-3-5227 2028 (FAX)
http://www.eit.deakin.edu.au/~peter-- The Eiffel guarantee: From specification to implementation
-- (
http://www.cetus-links.org/oo_eiffel.html)
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/eiffel_software/<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/eiffel_software/join (Yahoo! ID required)
<*> To change settings via email:
mailto:
eiffel_software-digest@...
mailto:
eiffel_software-fullfeatured@...
<*> To unsubscribe from this group, send an email to:
eiffel_software-unsubscribe@...
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/