for (var i = 0; i < 5; i++) { drawRec(root2, 50+i*100,-100,100,Math.random() * 100); } drawRec(root2, 100+i*50,Math.random()*200+200,40,400);