translateY = rand (1-9);
The solution can be ALMOST that simple. There's no reason to check the size of the array or loop by index. A for-in loop does that all for you:
Code:
global proc randomTY() {
string $sel_list[] = `ls -tr -sl`;
for ($curr_sel in $sel_list) {
setAttr ($curr_sel + ".ty") (rand(1, 9));
}
}
-- Mark