[Ns-bugs] [Bug 101] random variable intialization

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Wed Nov 2 21:45:03 PDT 2011


https://www.nsnam.org/bugzilla/show_bug.cgi?id=101

--- Comment #23 from Tom Henderson <tomh at tomh.org> 2011-11-03 00:45:01 EDT ---
(In reply to comment #22)
> The only issue I see with this is that to access the last substreams, you'll
> need to step through all of the previous substreams.  Since there are many
> substreams, it may add some overhead.
> 

Mathieu has a nice solution to this that seems to avoid stepping through all of
the previous streams.  The repository safe/ns-3-rng has this code:

The method RandomVariableStream::SetStream (int64_t stream) has these comments:

  if (stream == -1)
    {
      // The first 2^63 streams are reserved for automatic stream
      // number assignment.
      ...
  else
    {
      // The last 2^63 streams are reserved for deterministic stream
      // number assignment.
      ...
    }

note, there are actually more than 2^64 streams in the underlying generator but
we are just constraining it in ns-3 to 2^64 streams by use of the 64-bit
integer.

The new RngStream constructor calls some arithmetic to allow one to advance to
the proper stream as needed, without generating all of the prior ones.

I will try to get a patch out for review soon.

-- 
Configure bugmail: https://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Ns-bugs mailing list