var j=Array(0);var c=[5,3,4];var n=[1,3,5,8,10];for(var i=0;i<8;i++){j.push(n[Math.floor(Math.random()*n.length)]);for(var k=0;k<5;k++){for(var d=0;d<c.length;d++){j.push(j[j.length-1]+c[d])}}}for(var i=0;i<j.length;i++){song.addNote(new Note(song,piano[j[i]],i,1,0))} not very good