MathGroup Archive 2009

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

Search the Archive

Re: RandomReal gets stuck

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100275] Re: RandomReal gets stuck
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 31 May 2009 06:31:16 -0400 (EDT)

On 5/29/09 at 9:00 PM, bastraat at ucalgary.ca (Bas Straatman) wrote:

>For a simulation of a stochastic process I am making use of
>RandomReal. I noticed that at some point during the simulation the
>output of RandomReal[] becomes fixed. For some reason, totally
>beyond my comprehension, every time after I execute an optimization
>the RandomReal[] generates the same series of random numbers:

<snip>

>optimalactivity simpy calculates an optimum allocation of resources:

>optimalactivity := Table[y[i], {i, Length[inputmatrix]}] /.   Maximize[
>Plus @@ (Table[y[i], {i, Length[inputmatrix]}].(outputmatrix  -
>inputmatrix))[[consumables - 2]], CONDITIONS , Table[y[i], {i,
>Length[inputmatrix]}]][[2]]

>There is no SeedRandom[] anywhere to be found.

While it is true the code fragment above makes no call to
SeedRandom, that really doesn't mean much at all. This code
fragment calls several other things that are defined elsewhere
and makes no call to RandomReal. That is the problem has to be
at a lower level in the code you've written.

On my machine, there is no evidence RandomReal gets "stuck". For example,

In[1]:= Length@Union@Table[RandomReal[], {10^6}]

Out[1]= 1000000

In[2]:= $Version

Out[2]= 7.0 for Mac OS X x86 (64-bit) (February 19, 2009)

Note, it is more efficient to generate a million random values using

RandomReal[1, {10^6}]

I simply chose to use Table to call RandomReal a large number of
times since this is what you were doing.



  • Prev by Date: Re: printing problem with very simple application
  • Next by Date: Re: problem writing debugging utility function
  • Previous by thread: RandomReal gets stuck
  • Next by thread: Re: RandomReal gets stuck