Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Matching random numbers
Posted:
Aug 16, 1996 2:58 AM


In article <4uphfg$6b5@dragonfly.wolfram.com>, A. OrtizTapia <ao202@cus.cam.ac.uk> wrote: >Dear mathgroupers, > >I have written the following program:
[ Program deleted ]
>The purpose of this program is to produce two inpendent random numbers; >match this two numbers by "converting" them to integers, then if they >are equal print either of them (I choosed x), *and* increment the value >of a variable, such that at the end I can have 5000 "matched" random >numbers. The program, so far, gives out *only one number*.
If I understand you correctly, an easy way would be to evaluate
Table[match[],{k,5000}]
where match[] is a function defined to return a single "matched" value. For example:
match[] := Module[{x=Random[],y=Random[]}, While[Round[100x] != Round[100y], x = Random[]; y = Random[] ]; x ]
 Dave Seaman dseaman@purdue.edu ++++ stop the execution of Mumia AbuJamal ++++ ++++ if you agree copy these lines to your sig ++++ ++++ see http://www.xs4all.nl/~tank/spgl/sigaction.htm ++++



