for is weird in draw

function setup() { createCanvas(800,800) background(0) noFill() function draw() { for (var n = 0; n <= 300; n = n + 1) { var linep = { x: random(0, width), y: random(0, height) } stroke(255, 255, 255) line(linep.x, linep.y, width / 2, height / 2) } }

this is the code and you can see in the code that the number of lines drawn should be 300 but it draws endlessly. Can someone explain why? Thanks

Tagged:
Sign In or Register to comment.