Usando...
temp.sort(function(a,b){return Number(a) > Number(b);});
trace(temp);
all'interno del seguente codice..
//------------------------------------------------
stop();
var tutti = new Array();
var sublist = new Array();
function genera_sistema() {
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
while (a_length) {
tutti.unshift(a_length--);
_root.testo.text = tutti.join(" - ");
}
function generateNew(origin, len) {
var gen = new Array();
for (var i = 1; i<len; i++) {
var pos = Math.round(Math.random()*origin.length)-0;
gen.push(origin.splice(pos,1));
//verificavalore=gen; //combinazione...
}
return gen;
}
while (n_array) {
var temp = generateNew(tutti.slice(), n_length);
temp.sort(function(a,b){return Number(a) > Number(b);});
trace(temp);
sublist.push(temp); //insieme di combinazioni
n_array--
array_disordinato= _root.sublist.slice().join(" \n ")
_root.testo2.text =array_disordinato;
}
}
//------------------------fine codice------------------
nn funge...e temp mi risulta sempre una combinazione con i valori componenti non ordinati in maniera ascendente..
![]()
Non so piu' a che santo rivolgermi..![]()

e temp mi risulta sempre una combinazione con i valori componenti non ordinati in maniera ascendente..
Rispondi quotando