MathGroup Archive 2003

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

Search the Archive

RE: Random Trouble

  • To: mathgroup at
  • Subject: [mg39193] RE: [mg39178] Random Trouble
  • From: "David Park" <djmp at>
  • Date: Mon, 3 Feb 2003 01:08:56 -0500 (EST)
  • Sender: owner-wri-mathgroup at



myrandom = Random[]

and it will be fixed once and for all. But then why use Random at all? You
probably want to run different cases, each with a different random number.
Then use...

With[{myrandom = Random[]},
code using myrandom]

Then myrandom is fixed once and replaced in all its instances in the code.
For example...

With[{myrandom = Random[]},
  {myrandom, myrandom}]
{0.655465, 0.655465}

David Park
djmp at

From: Donald Darling [mailto:ddarling at]
To: mathgroup at

I have a program which uses a random number in several places - the same
number in a given run of the program. When I implement the program however
the number changes in every new call to it.  I've tried to overcome this
using "Which", "Hold", "Verbatim", and others, all to no avail.  Any help
greatly appreciated.

  • Prev by Date: Package creation
  • Next by Date: RE: diffrence between ver 3.01 and 4.1 regarding N[]?
  • Previous by thread: RE: Random Trouble
  • Next by thread: RE: Random Trouble