Created
September 20, 2018 22:25
-
-
Save seanlynch/7ea2ec6a7d98735f285910a724116d28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let grid = 40; | |
let lastrand = 0; | |
function setup() { | |
createCanvas(400, 400); | |
ellipseMode(CORNER); | |
} | |
function seed(x) { | |
lastrand = x; | |
} | |
function myrand(x) { | |
// This is probably slow in JS | |
lastrand = (lastrand * 1103515245 + 12345) % 0x7fffffff | |
return lastrand % x; | |
} | |
function draw() { | |
background(220); | |
seed(42); | |
for (let i = 0; i < grid; i++) { | |
for (let j = 0; j < grid; j++) { | |
fill(myrand(255)); | |
ellipse(i * (width/grid), | |
j * (height/grid), | |
10, 10); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment