By default NS2 is deterministic in nature that means the result is same for every run or simulation.

Statistical analysis is achieved by running simulation for several runs and finding averages or variance for all the runs. Since NS2 is deterministic so same results are there for every run. Therefore the variance of the results is will be zero. We require randomness so that the averages and variances would be meaningful.

Seed is a used for introducing this randomness. Different seed creates different results. In order to introduce randomness different seeds are used.

This can be achieved by inserting $defaultRNG seed n into the Tcl script prior to $ns run

where n is an integer. If n is

an integer, NS2 will use n as a seed for random number generator.

zero, NS2 will change the seed according to clock and counter. Basically, the simulation results tends to be different for every run.

For example, NS2 sets n to “1” by default. Therefore, every run generate the same result.

But if you set n to 101, by executing

$defaultRNG seed 101

the result would be different from the result corresponding to the default setting. But all the result with n = 101 would still be the same