Random numbers are often used in programming, everywhere from encrypting data to generative design. Processing offers simple function to get a random number:
random([lower Limit],[upper Limit])
Code Block |
---|
void setup()
{
size(500,500);
background(255);
fill(255);
stroke(0);
}
void draw()
{
//fill(random(100,150),random(0,100),random(150,255));
float size = random(10,100);
ellipse(random(0,width),random(0,height),size,size);
} |