dragonflymr
Dec 10, 2015Cirrostratus
proc - how to interpret
Hi,
I am puzzled what is exact purpose of char declaration in proc below (from
proc randomNumberGenerator {length {chars "0123456789"}} {
set range [expr {[string length $chars]-1}]
set txt ""
for {set i 0} {$i < $length} {incr i} {
set pos [expr {int(rand()*$range)}]
append txt [string range $chars $pos $pos]
}
return $txt
}
(from article)
I assume that char is receiving value (10) passed to proc via: set x [call library::randomNumberGenerator 10]. But what length {chars "0123456789"} is exactly doing here?
Piotr