12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

protected:RNG* rng_;};Classes derived from this abstract class implement specific distributio<strong>ns</strong>. Each distribution is parameterized with the valuesof appropri<strong>at</strong>e parameters. <strong>The</strong> value method is used to return a value from the distribution.<strong>The</strong> currently defined distributio<strong>ns</strong>, <strong>and</strong> their associ<strong>at</strong>ed parameters are:class UniformR<strong>and</strong>omVariableclass ExponentialR<strong>and</strong>omVariableclass ParetoR<strong>and</strong>omVariableclass ParetoIIR<strong>and</strong>omVariableclass Co<strong>ns</strong>tantR<strong>and</strong>omVariableclass HyperExponentialR<strong>and</strong>omVariableclass NormalR<strong>and</strong>omVariableclass LogNormalR<strong>and</strong>omVariablemin_, max_avg_avg_, shape_avg_, shape_val_avg_, cov_avg_, std_avg_, std_<strong>The</strong> R<strong>and</strong>omVariable class is available in OTcl. For i<strong>ns</strong>tance, to cre<strong>at</strong>e a r<strong>and</strong>om variable th<strong>at</strong> gener<strong>at</strong>es number uniformly on[10, 20]:set u [new R<strong>and</strong>omVariable/Uniform]$u set min_ 10$u set max_ 20$u valueBy default, R<strong>and</strong>omVariable objects use the default r<strong>and</strong>om number gener<strong>at</strong>or described in the previous section. <strong>The</strong> use-rngmethod can be used to associ<strong>at</strong>e a R<strong>and</strong>omVariable with a non-default RNG:set rng [new RNG]$rng seed 0set e [new R<strong>and</strong>omVariable/Exponential]$e use-rng $rng25.3 Integrals<strong>The</strong> class Integr<strong>at</strong>or supports the approxim<strong>at</strong>ion of (continuous) integr<strong>at</strong>ion by (discrete) sums; it is defined in~<strong>ns</strong>/integr<strong>at</strong>or.h asFrom integr<strong>at</strong>or.h:class Integr<strong>at</strong>or : public TclObject {public:Integr<strong>at</strong>or();void set(double x, double y);void newPoint(double x, double y);int comm<strong>and</strong>(int argc, co<strong>ns</strong>t char*co<strong>ns</strong>t* argv);226

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!