p5.js Random Numbers
Random numbers are often used in programming and can be found everywhere from encrypting data to generative design. In p5js there's a simple function to get a random number:
random( [lower limit], [upper limit] ) Â
function setup()
{
createCanvas(500,500);
background(255);
fill(255);
stroke(0);
}
function draw()
{
fill(random(100,150), random(0,100), random(150,255)); //random color
var size = random(10, 100); // random size
ellipse(random(0, width), random(0, height), size, size); //random eclipse size and position
}