Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

RandomReal gets stuck

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100264] RandomReal gets stuck
  • From: Bas Straatman <bastraat at ucalgary.ca>
  • Date: Fri, 29 May 2009 21:00:42 -0400 (EDT)
  • Organization: The University of Calgary

Hi,

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:

In[217]:= optimalactivity

Out[217]= {24, 336/25, 616/25, 32/5, 28/5, 76/25, 4, 8, 8, 4/5, 0, 0, \
0, 0, 0, 4/5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 12, 28, 80, 0, 104/3, 0, 234/125, 0, 0, 0, 0, 4, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

In[218]:= RandomReal[]

Out[218]= 0.455719

In[219]:= RandomReal[]

Out[219]= 0.977826

In[220]:= RandomReal[]

Out[220]= 0.943215

In[221]:= RandomReal[]

Out[221]= 0.962216

In[222]:= RandomReal[]

Out[222]= 0.302348

In[223]:= optimalactivity

Out[223]= {24, 336/25, 616/25, 32/5, 28/5, 76/25, 4, 8, 8, 4/5, 0, 0, \
0, 0, 0, 4/5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 12, 28, 80, 0, 104/3, 0, 234/125, 0, 0, 0, 0, 4, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

In[224]:= RandomReal[]

Out[224]= 0.455719

In[225]:= RandomReal[]

Out[225]= 0.977826

In[226]:= RandomReal[]

Out[226]= 0.943215

In[227]:= RandomReal[]

Out[227]= 0.962216

In[228]:= RandomReal[]

Out[228]= 0.302348

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.

Any ideas how this is possible? Thanks.

Bas Straatman


  • Prev by Date: Re: Tube in ParametricPlot3D with too many details
  • Next by Date: problem writing debugging utility function
  • Previous by thread: Re: TIFF file specification
  • Next by thread: Re: RandomReal gets stuck