"financings" is an array of objects. I want to scramble it and press the result array into the "plan" array, but the problem I encountered is: all "items" are consistent, I originally wanted to " Use "math.random" to replace the decimal after "return". The results of scrambled are all consistent, but it was scrambled once. I want to know how to make this "financings" scrambled five times.my code
console.log(financings)
var item= financings.sort(function(){return 0.2515775912009759>0.5?-1:1;});
console.log("item",item)
plan.push(item)
var item1= financings.sort(function(){return 0.6191500571921469>0.5?-1:1;});
console.log("item1",item1)
plan.push(item1)
var item2 = financings.sort(function(){return 0.5689188611053764>0.5?-1:1;});
console.log("item2",item2)
plan.push(item2)
var item3 = financings.sort(function(){return 0.8989393604075584>0.5?-1:1;});
console.log("item3",item3)
plan.push(item3)
var item4= financings.sort(function(){return 0.6471469188965746>0.5?-1:1;});
console.log("item4",item4)
plan.push(item4)
Aucun commentaire:
Enregistrer un commentaire