By default, NS2 runs deterministic simulation. That is, you will get the same result for every run. The deterministic setting is usually good for debugging, where you would like to know what goes wrong at an exact point.
Random Setting
Statistical analysis involves running simulation for several times and find averages/variance for all the runs. NS2 is deterministic by default. The results from every run with default setting are the same, and the variance of the results is therefore zero. Statistical analysis require randomness so that the avarages and variances would be meaningful.
In order to introduce a randomness to NS2, you will need to insert the following line into the Tcl Simulation script prior to "$ns run":
$defaultRNG seed n
where
By default, NS2 sets n
$default seed 101
the result would be different from the result corresponding to the default setting. But all the result with n
T. Issaraiyakul and E. Hossain, "Introduction to Network Simulator
NS2", Springer 2008.
http://www.springer.com/engineering/signals/book/978-0-387-71759-3
You may also find the following website useful:
http://www.ece.ubc.ca/~teerawat/NS2.htm