# My array hates me

I have an array that is meant to pick a number from each of the arrays and them to gether its sort of a game type application.

can some one take a look at my code and tell me why it still picks 1 and 2 even though they arent in the array!!!

``````
// rnadom parts of each question
easy1 = [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
easy2 = [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17];
boxArray = [a,b,c,d];
randa= Math.ceil(Math.random()*easy1.length);
randb= Math.ceil(Math.random()*easy2.length);
ans = randa+randb;
//removes from list so there cannot be any duplicates of the same answer
randArray = [-4, -3, -2, -1, 2, 3, 4, 5];
//--------------------------------------------------------
randans1 = Math.floor(Math.random() * randArray.length);
randLetter1 = Math.floor(Math.random() * boxArray.length);
boxArray[randLetter1].text = randArray[randans1]+ans;
boxArray.splice(randLetter1, 1);
randArray.splice(randans1, 1);
//--------------------------------------------------------
randans2 = Math.floor(Math.random() * randArray.length);
randLetter2 = Math.floor(Math.random() * boxArray.length);
boxArray[randLetter2].text = randArray[randans2]+ans;
boxArray.splice(randLetter2, 1);
randArray.splice(randans2, 1);
//--------------------------------------------------------
randans3 = Math.floor(Math.random() * randArray.length);
randLetter3 = Math.floor(Math.random() * boxArray.length);
boxArray[randLetter3].text = randArray[randans3]+ans;
boxArray.splice(randLetter3, 1);
randArray.splice(randans3, 1);
//---------------------------------------------------------
//---------------------------------------------------------
randLetter4 = Math.floor(Math.random() * boxArray.length);
_root.correct.text = boxArray[randLetter4];
if (boxArray[randLetter4]==a){_root.correct = 1; }
if (boxArray[randLetter4]==b){_root.correct = 2;}
if (boxArray[randLetter4]==c){_root.correct = 3;}
if (boxArray[randLetter4]==d){_root.correct = 4;}

boxArray[randLetter4].text = ans;
boxArray.splice(randLetter4, 1);

stop();

``````