Do make sure certain chores get no prevalence over other chores, association-wise, I made a little worklist randomizer.
Lets say I have a number of chores in a list:
set w { {washing up} {cut the grass} {shave (very important!)} {watch CNN} {finish some Tcl programs} {work in computer field} {buy tickets in a lottery} {go voting (even more important!)} {etc (whatever else comes up)} }
Now we want a random iten from the list, or a random permutation of the list, with no priorities:
lindex $w [expr int(9*rand())]
Of course we could do the same with the rest of the list.
Googie 17.09.2008 - I'd upgrade method of retrieving random entry:
lindex $w [expr { int([llength $w]*rand()) }]
But there is still missing solution for removing from list jobs that are already done. So we need a procedure for that:
proc lremove {varName idx} { upvar $varName lst set val [lindex $lst $idx] set lst [lreplace $lst $idx $idx] return $val }
and finally:
lremove w [expr { int([llength $w]*rand()) }]
enter categories here |
---|