set word "yummysheep"
proc scramble {word} {
set letters [split $word ""]
set newword ""
while {[llength $letters]} {
set i [rand [llength $letters]]
append newword [lindex $letters $i]
set letters [lreplace $letters $i $i]
}
return $newword
}
I've found the way to call the procedure, but what if I want to scramble a phrase, let say I want to scramble "word1 word2 word3" and I want the result something like "rd1ow 2odwr r3owd"? dont scramble the space, keep the space at it original location.