A Random Particle

// caleb b
// random particle
 
// generate random starting positions for the particle
float particleX = random(0.0, 500.0);
float particleY = random(0.0, 500.0);
 
void setup() {
  size(500, 500);
  
  frameRate(24);
}
 
void draw() {
  background(100, 100, 100); // erase everything
  ellipse(particleX, particleY, 20, 20); // draw the particle
  // adjust the particle's position
  particleX += random(-5, 5); 
  particleY += random(-5, 5);
}

Many Random Particles

// caleb b
// many random particles
 
class Particle {
  float x = random(50.0, 450.0);
  float y = random(50.0, 450.0);
  int r = (int) random(0, 255);
  int g = (int) random(0, 255);
  int b = (int) random(0, 255);
  
  void drawParticle() {
    fill(r, g, b);
    ellipse(x, y, 20, 20);
    x += random(-5, 5);
    y += random(-5, 5);
  }
}
 
Particle[] particles = new Particle[15];
 
void setup() {
  size(500, 500);
  
  for (int i = 0; i < 15; i++) {
    particles[i] = new Particle();
  }
  
  frameRate(24);
}
 
void draw() {
  background(100, 100, 100);
  for (Particle p : particles) {
    p.drawParticle();
  }
  
}