I've been trying to get NS2 to generate random nodes, finally, this tcl code seems to work nicely:
set rng [new RNG] $rng seed next-substream for {set i 0} {$i < $val(nn)} {incr i} { set n($i) [$ns node] $n($i) set X_ [$rng uniform 0.0 500.0] $n($i) set Y_ [$rng uniform 0.0 500.0] $n($i) set Z_ 0.0 #flat ground $ns initial_node_pos $n($i) 20 }

No comments:
Post a Comment