Dinamically assigned depths

This code works fine:


depths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
for (var i = 0; i<depths.length; i++) {
	_root.attachMovie("clip", "clip"+i, depths*);
	_root["clip"+i]._x = 30*i;
}

But when I try to change depths in a random way it doesen´t:


depths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
depths2 = [];
while (depths.length) {
	depths2.push(depths.splice(Math.floor(Math.random()*depths.length), 1));
}
depths = depths2;
for (var i = 0; i<depths.length; i++) {
	_root.attachMovie("clip", "clip"+i, depths*);
	_root["clip"+i]._x = 30*i;
}

Instead of appearing the 10 clip appears only one.

Any hint?

Thanks.