stop();
function ORDINA(el1,el2){
return el1-el2;
}
var tutti = new Array();
var sublist = new Array();
function genera_sistema() {
if (range==undefined) {
range=90;
}
var a_length = range; //lunghezza dell'array TUTTI
var n_length = quanti; // lunghezza dell'array COMPONENTI
var n_array = quante; // lunghezza dell'array COMBINAZIONI GENERATE
//-----------
// Generazione primo array "tutti"
while (a_length) {
tutti.unshift(a_length--);
_root.testo.text = tutti.join(" - ");
}
function generateNew(origin, len) {
var gen = new Array();
for (var i = 0; i<len; i++) {
var pos = Math.round(Math.random()*origin.length)-1;
gen.push(origin.splice(pos, 1));
}
return gen;
}
while (n_array) {
var temp = generateNew(tutti.slice(), n_length);
sublist.push(temp);
n_array--
array_disordinato= _root.sublist.slice().join(" \n ")
//PROVA ENNESIMA ORDINAMENTO SOTTO_ARRAYS GENERATI...
daordinare = new Array ("1", "67", "3", "24");
ordinato = daordinare.sort(ORDINA);
trace (ordinato);
//
_root.testo2.text =array_disordinato;
}
//_root.quante="";
//_root.quanti="";
_root.range="";
}
Dunque la funzione di ordinamento sopra menzionata in grassetto funge alla grande solo che dovrei applicarla non all'array fisso daordinare (messo solo per esempio) ma a quelli dinamici che sono le combinazioni create (che presentano ciascuna gli elementi senza ordine) visualizzate con:
_root.testo2.text =array_disordinato;
Sperando che questo codice ti aiuti ad aiutarmi aspetto tue nuove!
Grazie![]()
![]()

Rispondi quotando
VVoVe:
