draw = {
let ctx = canvas.getContext("2d");
let [r, s] = [radius, separation];
let seed = getSeed();
ctx.clearRect(0, 0, width, height);
ctx.lineWidth = linewidth;
for (
let y = r + linewidth, i = 0;
y + r < height;
i++, y += radius * (2 + s)
) {
setSeed(seed + i);
for (let x = r + linewidth; x + r < width; x += radius * (2 + s)) {
ctx.fillStyle = palette[~~(rand() * palette.length)];
ctx.beginPath();
ctx.arc(x, y, r, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
}
}
setSeed(seed);
}