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

Matching random numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4615] Matching random numbers
  • From: "A. Ortiz-Tapia" <ao202 at cus.cam.ac.uk>
  • Date: Wed, 21 Aug 1996 03:25:31 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Dear mathgroupers,
	
I have written the following program:

In[3]:=
 (count = 0 ;
  Label[nextrandom];
  pileup = pileup + 1;
  x = Random[];
 y = Random[];
 a = Round[100*x]; 
 b = Round[100*y]; 
 If[a== b,Return[x], Goto[nextrandom]];
  If[count == 5000, Break[]]; 
Goto[nextrandom])

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*.

I would like to have some comments



Arturo Ortiz-Tapia
Dept Theoretical Chemistry
Cambridge University, UK


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


  • Prev by Date: "Optimized" Plane
  • Next by Date: Compiled functions
  • Previous by thread: Re: "Optimized" Plane
  • Next by thread: Re: Matching random numbers