For loop in which the counter goes up to a value generated by Math.floor()