set range 4
for {set i 0} {$i <= $range} {incr i} { set a($i) 0 }
for {set i 0} {$i < 100000} {incr i} { incr a([randomRange $range]) }
array get a
Resilt with randomRange: 0 24960 1 24994 2 25031 3 25015 4 0
Result with new proposal: 0 20024 1 19958 2 20032 3 20004 4 19982