rng-test.tcl

来自「跑leach需要的」· TCL 代码 · 共 46 行

TCL
46
字号
## Usage: ns rng-test.tcl [replication number]#if {$argc > 1} {    puts "Usage: ns rng-test.tcl \[replication number\]"    exit}set run 1if {$argc == 1} {    set run [lindex $argv 0]}if {$run < 1} {    set run 1}# seed the default RNGglobal defaultRNG$defaultRNG seed 9999# create the RNGs and set them to the correct substreamset arrivalRNG [new RNG]set sizeRNG [new RNG]for {set j 1} {$j < $run} {incr j} {    $arrivalRNG next-substream    $sizeRNG next-substream}# arrival_ is a exponential random variable describing the time between# consecutive packet arrivalsset arrival_ [new RandomVariable/Exponential]$arrival_ set avg_ 5$arrival_ use-rng $arrivalRNG# size_ is a uniform random variable describing packet sizesset size_ [new RandomVariable/Uniform]$size_ set min_ 100$size_ set max_ 5000$size_ use-rng $sizeRNG# print the first 5 arrival times and sizesfor {set j 0} {$j < 5} {incr j} {    puts [format "%-8.3f  %-4d" [$arrival_ value] \	    [expr round([$size_ value])]]}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?