[Ns-developers] ns-2/3 RNG

Mathieu Lacage Mathieu.Lacage at sophia.inria.fr
Mon Feb 20 09:04:17 PST 2006


On Mon, 2006-02-20 at 08:55 -0500, Pierre L'Ecuyer wrote:

> GSL does not provide (automatically managed) multiple streams.
> The user can implement the multiple streams himself/herself by selecting 
> different
> seeds and managing everything but this is very cumbersome (these seeds 
> must be stored
> and retrieved to implement common random numbers, etc.).
> When selecting the seeds, one must also make sure that the streams do 
> not overlap
> and do not have apparent correlation.  This is also not easy.
> The multiple streams package does all of that automatically.
> For more details, see Example 1.1 in
> http://www.iro.umontreal.ca/~simardr/ssj/examples/examples.pdf
> and the package documentation in
> http://www.iro.umontreal.ca/~simardr/ssj/doc/pdf/guiderng.pdf

I see. This is why you calculate yourself the seed of the stream to be
generated next in your mrg32k3a implementation. I thought naively that
it might have been enough to use a single instance of a uniform RNG and
make it feed 32 bit seeds to each newly-instantiated stream. Was I
really badly wrong ?

[snip]


> >I have to confess that the idea of porting the ns-2 random number
> >generator does not bother me but the idea of having to rewrite my own
> >generators for various distributions strikes me as not so useful. I
> >would rather spend my time working on simulation models :/
> >  
> >
> 
> Who said that you have to rewrite your generator for various distributions?

I think I was using "generator" here to mean "more or less complicated
numerical computation". I was a bit lax in my vocabulary...

Here is a more detailed explanation of what I meant: I am under the
impression that to generate other distributions than the uniform
distribution, you have two solutions:
  - generate a floating-point uniform distribution and apply the
distribution formula on it, nothing smart.
  - use a smart formula which combines multiple uniform distributions to
generate the right output (reading a bit of my knuth shows a bunch of
such really smart formulas).

In both cases, you have to do quite a bit of numerical calculation and I
worry about these because I have learned painfully that making sure
these calculations are stable and well rounded is hard (at least to me).

So, while naively implementing these distributions on top of a uniform
distribution is trivial (all we have to do is to just ignore precision
issues, ignore how the calculations shuffle and dump the random bits we
have spent so much time painfully generating), I fear I or someone else
will have to spend time to make them deal with unconstrained input. I
have been burned very badly here and I know I don't have the expertise
to deal with this sort of problem.

thanks a lot for your useful answers,
Mathieu
-- 



More information about the Ns-developers mailing list