[ns] Random variables

Salvador Alcaraz Carrasco salcaraz at obelix.umh.es
Wed Sep 21 14:05:50 PDT 2005


Karim:

you can run next a very easy TCL script:

#####################################################
set RVar [new RandomVariable/Exponential]
$RVar set avg_ 10

set i 1

while {$i < 10 } {
     set t [$RVar value]
     puts "value($i) = $t";
    incr i
}
#################################################

and the output will be, for example:

value(1) = 7.987809e+01
value(2) = 5.872015e+00
value(3) = 4.254185e+01
value(4) = 2.429025e+01
value(5) = 8.183173e+00
value(6) = 2.241998e+00
value(7) = 1.161674e+01
value(8) = 2.027577e+00
value(9) = 1.449866e+01


Bye

/salva




On Wed, 21 Sep 2005, karim zerioh wrote:

>
>
> Hi,
>
> I want to know how i can use random variables in ns.
> Here i can declare an exponential variable:
> set e [new RandomVariable/Exponential]
> $e set avg_ 10.0
> But i don't know how to get the generated numbers.
>
>
> Thank you for advance
>
>
>
> ___________________________________________________________
> How much free photo storage do you get? Store your holiday
> snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
>

__________________________________________________________________________
Salvador Alcaraz Carrasco                      http://www.umh.es
Arquitectura y Tecnología de Computadores      http://obelix.umh.es
Dpto. Física y Arquitectura de Computadores    salcaraz[arroba]umh.es
Universidad Miguel Hernández                   salcaraz[arroba]obelix.umh.es
Avda. de la universidad, s/n                   Telf. +34 96 665 8495
Elche, Alicante (Spain)
__________________________________________________________________________


More information about the Ns-users mailing list