set ns [new Simulator]
set node_(0) [$ns node]
set Val(x) 500
set Val(y) 500
$node_(0) set X_ [expr rand()*$val(x)]
$node_(0) set Y_ [expr rand()*$val(y)]
$node_(0) set Z_ 0
where,
ns → Simulator instance
rand() → Random Function
$val(x) → X dimension of the network
$val(y) → Y dimension of the network