-1
我试图将它们传递给一个函数,并放入数组中,但结果。我想不出任何解决办法。这是结果:试图结合随机数字
一个我想是这个样子
[4,4,5,4]
但输出是
[4, 4, 4, 4]
[4, 4, 4, 4]
[5, 5, 5, 5]
[4, 4, 4, 4]
$("#machine1").slotMachine({
active : 0,
delay : 500,
randomize : function(activeElementIndex){
var activeElementIndex = Math.floor(Math.random() * (9 - 0 + 1)) + 0;
//console.log(activeElementIndex);
call_me(activeElementIndex);
return activeElementIndex;
}
}).shuffle(5);
$("#machine2").slotMachine({
active : 0,
delay : 700,
direction: 'down',
randomize : function(activeElementIndex){
var activeElementIndex = Math.floor(Math.random() * (9 - 0 + 1)) + 0;
//console.log(activeElementIndex);
call_me(activeElementIndex);
return activeElementIndex;
}
}).shuffle(5);
$("#machine3").slotMachine({
active : 0,
delay : 900,
randomize : function(activeElementIndex){
var activeElementIndex = Math.floor(Math.random() * (9 - 0 + 1)) + 0;
//console.log(activeElementIndex);
call_me(activeElementIndex);
return activeElementIndex;
}
}).shuffle(5);
$("#machine4").slotMachine({
active : 0,
delay : 1100,
direction: 'down',
randomize : function(activeElementIndex){
var activeElementIndex = Math.floor(Math.random() * (9 - 0 + 1)) + 0;
//console.log(activeElementIndex);
call_me(activeElementIndex);
return activeElementIndex;
}
}).shuffle(5);
function call_me(wait){
var nice = [];
for(var i = 0; i < 4; i++){
nice[i] = wait;
}
console.log(nice);
}
谢谢,它解决了我的问题!竖起大拇指给你! –
谢谢你们Edvin Tenovimas和@Guy Altman –