* Re: random number generation -> PLEASE HELP! [not found] ` <vi8k9uh3r59.fsf@fnal.gov> @ 1996-09-05 0:00 ` Dr. John B. Matthews 1996-09-06 0:00 ` Philip Brashear 1996-09-08 0:00 ` Uri Raz 1996-09-06 0:00 ` Robert I. Eachus 1 sibling, 2 replies; 5+ messages in thread From: Dr. John B. Matthews @ 1996-09-05 0:00 UTC (permalink / raw) In article <vi8k9uh3r59.fsf@fnal.gov>, Oleg Krivosheev <kriol@fnal.gov> writes: > ica2ph@alpha1.csv.ica.uni-stuttgart.de (Peter Hermann) writes: >> Justin Vandenbroucke (rva036@lulu.acns.nwu.edu) wrote: >> : Does anyone know how to generate "random" numbers in pascal? I know BASIC >> : has a standard function that does it, and I know there is some actual code >> >> Ada95, the natural successor of Pascal, has a standard function, of course. >> see http://lglwww.epfl.ch/Ada/ > > C, the natural successor of assembler, has it too... And who cares? > THere are no words in standard about required rnd genertor quality, so > it's hardly usefull for anything but (simple) games Nonsense. GNAT (the GNU Ada compiler from NYU; http://www.gnat.com/) and MacOS (http://www.apple.com) have very satisfactory psuedo- random number generators. The former is available in source from ftp://ftp.cs.nyu.edu/pub/gnat; the latter is shown below. unit ACMRandom; interface procedure SetACMSeed (seed: LongInt); function ACMRandom: LongInt; implementation var acmRandSeed: LongInt; {static variable} procedure SetACMSeed (seed: LongInt); begin if seed = 0 then seed := 1; if seed < 0 then seed := -seed; acmRandSeed := seed; end; function ACMRandom: LongInt; {"minimal standard random number generator" proposed by} {Parker & Miller in CACM, 1988; it has period (2^31)-1} var lo, hi, test: LongInt; begin hi := acmRandSeed div 127773; lo := acmRandSeed mod 127773; test := 16807 * lo - 2836 * hi; if test > 0 then acmRandSeed := test else acmRandSeed := test + maxLongInt; ACMRandom := acmRandSeed; end; end. program RandomTest; uses QuickDraw, ACMRandom; var i: Integer; begin randSeed := 123456789; SetACMSeed(randSeed); for i := 1 to 25 do WriteLn(Random : 7, randSeed : 12, ACMRandom : 12); end. John ---------------------------------------------------------------- Dr. John B. Matthews jmatthews@nova.wright.edu; john_matthews@ccmail.dayton.saic.com "Whom the gods would destroy, they first invite to program in C" ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: random number generation -> PLEASE HELP! 1996-09-05 0:00 ` random number generation -> PLEASE HELP! Dr. John B. Matthews @ 1996-09-06 0:00 ` Philip Brashear 1996-09-08 0:00 ` Uri Raz 1 sibling, 0 replies; 5+ messages in thread From: Philip Brashear @ 1996-09-06 0:00 UTC (permalink / raw) >Nonsense. GNAT (the GNU Ada compiler from NYU; http://www.gnat.com/) >and MacOS (http://www.apple.com) have very satisfactory psuedo- >random number generators. The former is available in source from >ftp://ftp.cs.nyu.edu/pub/gnat; the latter is shown below. > Version 2.1 of the Ada Compiler Evaluation System has tests for checking the performance of Ada 95 random value (not just number) generators. As a side effect, these tests output some (minimal) statistics relevant to the actual distribution of the generated values. The ACES is available at sw-eng.falls-church.va.us, anonymous ftp, directory public/AdaIC/testing/aces URL is http://sw-eng.falls-church.va.us/adaic/testing/aces Questions? Contact me. Phil Brashear CTA INCORPORATED (513) 258-0831 brashear.cta@juno.com brashear@sw-eng.falls-church.va.us ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: random number generation -> PLEASE HELP! 1996-09-05 0:00 ` random number generation -> PLEASE HELP! Dr. John B. Matthews 1996-09-06 0:00 ` Philip Brashear @ 1996-09-08 0:00 ` Uri Raz 1996-09-10 0:00 ` Richard A. O'Keefe 1 sibling, 1 reply; 5+ messages in thread From: Uri Raz @ 1996-09-08 0:00 UTC (permalink / raw) Look at http://nr.harvard.edu/nr/ - the numerical recipes books contain a chapter about random number generators, as well as refernces to other books (e.g. Knuth's, which is easily accessable) about the subject. Hope this helps, Uri Raz. +---------+--------------------+-------+-------+ | Uri Raz | uraz@iil.intel.com | Noir | :-) | | All opinions are mine. Others may share it. | +----------------------------------------------+ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: random number generation -> PLEASE HELP! 1996-09-08 0:00 ` Uri Raz @ 1996-09-10 0:00 ` Richard A. O'Keefe 0 siblings, 0 replies; 5+ messages in thread From: Richard A. O'Keefe @ 1996-09-10 0:00 UTC (permalink / raw) Uri Raz <uraz@iil.intel.com> writes: >Look at http://nr.harvard.edu/nr/ - the numerical recipes books contain > a chapter about random number generators, as well as refernces to other > books (e.g. Knuth's, which is easily accessable) about the subject. Urrrr, the Numerical Recipes books have been severely mauled in review. Their C version in particular is, well, less than idiomatic. The errata for volumes 1, 2, and 3 of The Art of Computer Programming are available: visit Knuth's Web page. Anyone seriously interested in random number generation and planning to take advice from Knuth should *definitely* read the errata to volume 2. A lot of people have implemented "Lagged Fibonacci" generators based on that book, but recently they were found to badly fail a fairly simple statistical test. This does mean that the lagged Fibonacci generator in Numerical Recipes should not be used any longer. Knuth's errata describe the problem and offer a choice of two simple fixes. The code is even in C this time, not MIX! I offer this definition: "good pseudo-random number generator: one whose fatal flaws have not yet been discovered". -- Australian citizen since 14 August 1996. *Now* I can vote the xxxs out! Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: random number generation -> PLEASE HELP! [not found] ` <vi8k9uh3r59.fsf@fnal.gov> 1996-09-05 0:00 ` random number generation -> PLEASE HELP! Dr. John B. Matthews @ 1996-09-06 0:00 ` Robert I. Eachus 1 sibling, 0 replies; 5+ messages in thread From: Robert I. Eachus @ 1996-09-06 0:00 UTC (permalink / raw) In article <1996Sep5.165031@nova.wright.edu> jmatthews@nova.wright.edu (Dr. John B. Matthews) writes: > Nonsense. GNAT (the GNU Ada compiler from NYU; http://www.gnat.com/) > and MacOS (http://www.apple.com) have very satisfactory psuedo- > random number generators. The former is available in source from > ftp://ftp.cs.nyu.edu/pub/gnat; the latter is shown below... Calling the Minimal Standard Random Number Generator good is true only in comparison to lots of other junk generators out there. The generator that comes with GNAT is much better. If you want the gory details as to why send me email. (Or you can just read the published literature if you want to find out why linear congruential generators are not very good. Of course, in any case, I really wouldn't trust implementations which get the credits that badly wrong. (Among other things the CACM paper was by Stephen PARK and Keith Miller, but the generator is actually due to Lewis, Goodman, and Miller. However the implementation here is apparently from a third source. The constants do check out though.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is... ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-09-10 0:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <rva036-2208962255270001@aragorn189.nuts.nwu.edu> [not found] ` <vi8k9uh3r59.fsf@fnal.gov> 1996-09-05 0:00 ` random number generation -> PLEASE HELP! Dr. John B. Matthews 1996-09-06 0:00 ` Philip Brashear 1996-09-08 0:00 ` Uri Raz 1996-09-10 0:00 ` Richard A. O'Keefe 1996-09-06 0:00 ` Robert I. Eachus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox