[Ns-developers] Random Variables API changes

Raj Bhattacharjea raj.b at gatech.edu
Tue Jan 20 11:20:51 PST 2009


On Tue, Jan 20, 2009 at 1:13 PM, Michele Weigle
<mweigle at csnet.cs.odu.edu> wrote:
> On Jan 19, 2009, at 3:31 PM, Mathieu Lacage wrote:
>> as well as the code necessary for the above. There is a big XXX which I
>> don't know how to fix: I assume that michele will know what to do which
>> is why I CCed her.
>
> Yes, we just need to add one line in EnsureGlobalInitialized() to set things
> to the correct substream:
>
>   SetPackageSeed (seedArray);
> +  // set to the chosen substream (run)
> +  ResetNthSubstream (run);
>  }

I applied this change, but then I realized that the
EnsureGlobalInitialized method is static, while the ResetNthSubstream
is not.  I believe we should instead read the value of the global
default and apply that run number in the RngStream constructor:

RngStream::RngStream ()
{
  EnsureGlobalInitialized ();
  uint32_t run;
  IntegerValue value;
  g_rngRun.GetValue (value);
  run = value.Get ();
  ResetNthSubstream(run);
  ...
}

BUT, in this case, I'm not sure where to move the env var parsing code
for the run number.

-- 
Raj Bhattacharjea
Georgia Institute of Technology
School of Electrical and Computer Engineering
Ph.D. Candidate
Systems Analyst
404.894.2955


More information about the Ns-developers mailing list