Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -14,22 +14,22 @@ proc random_items { item_list {n 1} {dups no} } {
|
|||
|
||||
set count 0
|
||||
|
||||
while { $count < $n } {
|
||||
while { $count < $n } {
|
||||
|
||||
# random integer index 0..len-1
|
||||
set idx [expr { int(rand() * $max)} ]
|
||||
# random integer index 0..len-1
|
||||
set idx [expr { int(rand() * $max)} ]
|
||||
|
||||
# pick item
|
||||
set item [lindex $items $idx]
|
||||
# pick item
|
||||
set item [lindex $items $idx]
|
||||
|
||||
# check for dups
|
||||
if {$dups eq no} {
|
||||
set srch [lsearch $result $item]
|
||||
if {$srch > -1} { continue }
|
||||
}
|
||||
# check for dups
|
||||
if {$dups eq no} {
|
||||
set srch [lsearch $result $item]
|
||||
if {$srch > -1} { continue }
|
||||
}
|
||||
|
||||
lappend result $item
|
||||
incr count
|
||||
lappend result $item
|
||||
incr count
|
||||
}
|
||||
return $result
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue