Randomize

randomize() #

Randomly re-arranges the quadrille cells.

Example #

(mouse click to randomize; press any key to reset)

code
Quadrille.cellLength = 32;
let mandrill;
let quadrille;

function preload() {
  mandrill = loadImage('mandrill.png');
}

function setup() {
  createCanvas(512, 512);
  quadrille = createQuadrille(16, mandrill);
}

function draw() {
  drawQuadrille(quadrille);
}

function mouseClicked() {
  quadrille.randomize();
}

function keyPressed() {
  quadrille = createQuadrille(16, mandrill);
}

Syntax #

randomize()