fixed seeds for tutorial examples and updates to tutorial to match
authorCraig Dowell <craigdo@ee.washington.edu>
Wed, 17 Dec 2008 12:17:17 -0800
changeset 4028 13c1916747f2
parent 4027 cb86fb0fd36e
child 4029 4267fd454004
fixed seeds for tutorial examples and updates to tutorial to match
doc/tutorial/building-topologies.texi
doc/tutorial/conceptual-overview.texi
examples/first.cc
examples/second.cc
examples/third.cc
--- a/doc/tutorial/building-topologies.texi	Tue Dec 16 17:47:28 2008 -0800
+++ b/doc/tutorial/building-topologies.texi	Wed Dec 17 12:17:17 2008 -0800
@@ -105,6 +105,13 @@
     LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
 @end verbatim
 
+A fixed seed is provided to the random number generators so that they will
+generate repeatable results.
+
+@verbatim
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+@end verbatim
+
 Next, you will see some familiar code that will allow you to change the number
 of devices on the CSMA network via command line argument.  We did something
 similar when we allowed the number of packets sent to be changed in the section
@@ -657,6 +664,13 @@
     LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
 @end verbatim
 
+A fixed seed is provided to the random number generators so that they will
+generate repeatable results.
+
+@verbatim
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+@end verbatim
+
 Next, you will see more familiar code that will allow you to change the number
 of devices on the CSMA and Wifi networks via command line argument.
 
--- a/doc/tutorial/conceptual-overview.texi	Tue Dec 16 17:47:28 2008 -0800
+++ b/doc/tutorial/conceptual-overview.texi	Wed Dec 17 12:17:17 2008 -0800
@@ -362,6 +362,21 @@
 INFO level for echo clients and servers.  This will result in the application
 printing out messages as packets are sent and received during the simulation.
 
+The next line of code is used to give a fixed seed to the random number 
+generators so that they will generate repeatable results.  In the example
+programs, it allows us to thouroughly document the output of the trace files
+in a consistent way.  Having a fixed seed also allows us to use the examples 
+in our regression testing framework.
+
+@verbatim
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+@end verbatim
+
+Random variables are very important in understanding how to get repeatable
+results, so you are encouraged to read the Doxygen and manual sections to
+understand what is going on there.  For us, the main concern is in making 
+random backoff algorithms consistent across runs.
+
 Now we will get directly to the business of creating a topology and running 
 a simulation.  We use the topology helper objects to make this job as
 easy as possible.
--- a/examples/first.cc	Tue Dec 16 17:47:28 2008 -0800
+++ b/examples/first.cc	Wed Dec 17 12:17:17 2008 -0800
@@ -29,6 +29,8 @@
   LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
   LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
 
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+
   NodeContainer nodes;
   nodes.Create (2);
 
--- a/examples/second.cc	Tue Dec 16 17:47:28 2008 -0800
+++ b/examples/second.cc	Wed Dec 17 12:17:17 2008 -0800
@@ -39,6 +39,8 @@
   LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
   LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
 
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+
   uint32_t nCsma = 3;
   CommandLine cmd;
   cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices", nCsma);
--- a/examples/third.cc	Tue Dec 16 17:47:28 2008 -0800
+++ b/examples/third.cc	Wed Dec 17 12:17:17 2008 -0800
@@ -43,6 +43,8 @@
   LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
   LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
 
+  RandomVariable::UseGlobalSeed (1, 1, 2, 3, 5, 8);
+
   uint32_t nCsma = 3;
   uint32_t nWifi = 3;
   CommandLine cmd;