Use for optimal results:
for(var i = 0; i < 500; i++) {
song.addNote(new Note(song,
piano[Math.round(Math.random()*piano.length)] /*note (piano is an array of B7...C2) */,
Math.round(Math.random()*16*[Measures]) /*time*/,
1 /*length in 1/4 intervals*/,
0 /*instrument, high number for invisible notes*/));
}