Ver Mensaje Individual
  #4 (permalink)  
Antiguo 27/04/2005, 15:22
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 3 meses
Puntos: 193
Asi rapido se me ocurrio esto:

Código:
function randomize(cuantos:Number):Array {
	var count:Number = 0;
	var tempSource:Array = [];
	var tempReturn:Array = [];
	while (++count<(cuantos+1)) {
		tempSource.push(count);
	}
	while (tempSource.length) {
		var index = random(tempSource.length);
		var element = tempSource.splice(index, 1);
		tempReturn.push(element);
	}
	return tempReturn;
}
trace(randomize(5));
Esto regresa algo asi

1,2,4,3,5
3,1,4,2,5
3,2,4,5,1
2,3,1,4,5
4,2,5,3,1
4,5,3,2,1
1,3,5,2,4
3,1,4,5,2
3,2,4,5,1