rand(times, value)

Randomly fills the quadrille with the specified value a given number of times.

Example

(numeric keys define times; other keys define value)

edit, then run

Note

For deterministic (repeatable) randomness, explicitly call randomSeed(seed) before rand(times, value).

Syntax

rand(times, value)

Parameters

Param Description
times Number: number of cells to fill randomly
value1 Any: A valid JavaScript value
  1. A plain function value is stored, not called — it becomes a per-cell display routine ({ row, col, options }) => { ... } (see options). To have a function evaluated per cell at fill time — a fresh object or a varied tile per cell — tag it: Quadrille.factory(({ row, col }) => new Object(...)). ↩
What this page's examples use
p5.quadrille
drawQuadrille createQuadrille cellLength rand width height order
p5.js
createCanvas background color key position random height style createP html

Names the analysis can prove are called, and the line each one is documented on. Local variables and members of an unknown receiver are left out.