Getting Network Simulation Basics Right – A Note on Seed Setting Effects for the ns-2 Random Number Generator
The ns-2 network simulator is one of the most widely used packet network simulators. Since version 2.1b9, it uses the MRG32k3a random number generator (RNG) proposed by L’Ecuyer, replacing the previous minimal standard multiplicative linear congruential generator by Park and Miller to remedy the problems of sensitivity to seeds and short-period length. Unfortunately, due to bad documentation and re-use of old scripts many people still wrongly use the old API functions to explicitly set seeds. While the old RNG required this, in the current MRG32k3 implementation the same approach leads to overriding the automatic seed generation of the new generator which can result in correlation between the generated random values. Using a wired and a wireless scenario we illustrate possible effects on simulation results. As the ns-2 community relies heavily on exchanging hints and scripts, which keep re-infecting the knowledge-base even years after the introduction of the new RNG we believe that this might affect the majority of all ns-2 simulation results currently published.
KeywordsRandom Number Generator Replication Number Average Queue Length Current Replication Linear Congruential Generator
This research has been partly funded by the Austrian Federal Ministry for Education, Science, and Culture, and the European Social Fund (ESF) under grant 31.963/46-VII/9/2002 and partly by the Austrian Kplus competence center program. Figures 2–8 reprinted from  with kind permission by IEEE.
- 1.nsnam web pages, http://www.isi.edu/nsnam/, last visited: Jul. 2007.
- 2.K. John: Ousterhout: Tcl and the Tk Toolkit, Addison-Wesley, Reading, MA, USA, ISBN 0-201-63337-X, 1994.Google Scholar
- 4.B. Hechenleitner and K. Entacher: On Shortcomings of the ns-2 Random Number Generator. In T. Znati and B. McDonald, eds., Communication Networks and Distributed Systems Modeling and Simulation (CNDS), 2002.Google Scholar
- 6.K. Fall and K. Varadhan (Eds.): The ns Manual (formerly ns Notes and Documentation), http://www.isi.edu/nsnam/ns/ns-documentation.html, last visited: Oct. 2006.
- 7.E. Altman and T. Jimenez: ns-2 for Beginners, lecture notes, Dec. 2003, http://www-sop.inria.fr/maestro/personnel/Eitan.Altman/COURS-NS/n3.pdf, last visited: Oct. 2006.
- 8.ns-users mailing list, email@example.com, subscription on the Web via http://mailman.isi.edu/mailman/listinfo/ns-users, last visited: Jul. 2007.
- 10.S. Kurkowski, T. Camp, M. Colagrosso: MANET Simulation Studies: The Incredibles, ACM SIGMOBILE Mobile Computing and Communications Review, 9(4), Oct. 2005.Google Scholar
- 11.P. L'Ecuyer: Random Number Generation, Chapter 2 of the Handbook of Computational Statistics, J.E. Gentle, W. Haerdle, and Y. Mori, eds., Springer-Verlag, New York, 2004, 35–70.Google Scholar
- 13.M. Umlauft and P. Reichl: Experiences with the ns-2 network simulator – explicitly setting seeds considered harmful. In Proc. Wireless Telecommunications Symposium (WTS), April 2007, Pomona, CA, USA.Google Scholar