Randomly re-arranges the quadrille cells.
Example #
(mouse click to randomize; press any key to reset)
code
Quadrille.cellLength = 32;
let mandrill;
let quadrille;
async function setup() {
createCanvas(512, 512);
mandrill = await loadImage('mandrill.png');
quadrille = createQuadrille(16, mandrill);
}
function draw() {
drawQuadrille(quadrille);
}
function mouseClicked() {
quadrille.randomize();
}
function keyPressed() {
quadrille = createQuadrille(16, mandrill);
}
For deterministic (repeatable) randomness, explicitly call randomSeed(seed) before randomize()
.
Syntax #
randomize()