[Ns-developers] ns-2/3 RNG
Mathieu.Lacage at sophia.inria.fr
Sun Dec 18 23:26:01 PST 2005
I think I forgot to add a requirement which was so obvious to me that I
did not bother but which is quite important (to me at least): A nice C++
API which does not depend on tcl. i.e. if I #include "rng.h", I should
not have to bring in tclcl.h. The tcl API is of little interest to me
but I really would like to have a nice C++ API.
On Fri, 2005-12-16 at 08:46 +0100, Mathieu Lacage wrote:
> hi michele,
> As a user, It is easy for me to express my requirements. I have no idea
> how they map to the various solutions you outlined so I will leave the
> technical aspects of the discussion to others.
> 1) ability to create multiple random number generator instances which
> will not generate the same random number series during a single run of
> the simulator.
> 2) ability to force a seed to each independent random number generator
> (but you should not be forced to specify a seed. A seed should be chosen
> by default if you don't choose one and it should be the same one for
> each run of the same program).
> 3) debugging mode where you can force every random number to ignore the
> seed provided (could be selectable by a compiler switch or a runtime
> environment variable) and use the same arbitrary seed for each run.
> 4) need for a simple way to get a really random seed which changes with
> each run of a program. Ideally, it would be possible to force all the
> random number generators for which a non-explicit seed is provided to be
> initialized by such a really random seed.
> 5) need for various non-uniform random distributions
> As a non-sophisticated user, it seems to me that gsl provides the basic
> service on which to implement the requirements described above. I have
> used gsl to do things like this and it felt ok. Of course, as a user, I
> don't really care which solution is used, provided I don't have to
> maintain a random number generator myself. As a non sophisticated user,
> I have to say I never ever worried about the quality of the underlying
> random number generators.
> I hope the above descriptions are clear. If not, please, let me know: I
> have a very clear interest in trying to make sure the ns-3 API fulfill
> my needs :)
> On Thu, 2005-12-15 at 20:25 -0500, Michele Weigle wrote:
> > Hi all,
> > Tom H. suggested that I start a discussion on the list about the RNG
> > used in ns-2 and what should be used in ns-3.
> > I contributed the code for the current RNG for ns-2. It's a MRG32k3a
> > RNG proposed by Pierre L'Ecuyer and provides 1.8x10^19 independent
> > streams of random numbers, each of which consists of 2.3x10^15
> > substreams. Each substream has a period (i.e., the number of random
> > numbers before overlap) of 7.6x10^22. The period of the entire generator
> > is 3.1x10^57. This RNG allows for many, many independent streams and
> > substreams, which provides users a nice way to have multiple independent
> > replications of experiments.
> > Tom mentioned that some other contributors have used the GSL
> > (http://www.gnu.org/software/gsl/) for the RNG, which offers some nice
> > features including multiple types of RNGs and lots of random variable
> > distributions. The default RNG in GSL is fairly new and has a very long
> > period.
> > It may be nice to move to using the GSL for ns-3 (it would be
> > something
> > else that we don't have to maintain). But, the only thing I'm concerned
> > about is a methodological point. With the L'Ecuyer code, you could have
> > a separate RNG stream for each random variable you had (for example,
> > HTTP request sizes or HTTP response sizes). Then, for each run, you
> > could select a substream of the RNG and be sure that the numbers
> > generated were independent. For example, if you wanted to do run 5, you
> > could select the 5th substream for both the request size RNG and the
> > response size RNG. I don't know how you would do something like that
> > with the GSL.
> > Does anyone have more experience with using the GSL RNGs in this
> > way, or
> > have an opinion on what we should use in ns-3? The important thing is
> > that if you have multiple random variable distributions, you want the
> > random number streams for each of those distributions to be independent.
> > -Michele
> > --
> > Michele Weigle
> > Assistant Professor
> > mweigle at cs.clemson.edu
> > http://www.cs.clemson.edu/~mweigle
> > 306 McAdams Hall
> > Department of Computer Science
> > Clemson University
> > Clemson, SC 29634-1906
More information about the Ns-developers