Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matching random numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4628] Re: Matching random numbers
  • From: ags at seaman.cc.purdue.edu (Dave Seaman)
  • Date: Wed, 21 Aug 1996 03:25:42 -0400
  • Organization: Purdue University
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4uphfg$6b5 at dragonfly.wolfram.com>,
A. Ortiz-Tapia <ao202 at 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 at purdue.edu
      ++++ stop the execution of Mumia Abu-Jamal ++++
    ++++ if you agree copy these lines to your sig ++++
++++ see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ++++

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Piecewise Functions
  • Next by Date: Re: The farthest apart points problem
  • Previous by thread: Matching random numbers
  • Next by thread: Re: Matching random numbers