home/ atoms/ processing-random-noise

random() produces uniform random values while noise() produces smooth correlated pseudo-random values

random(min, max) returns a uniformly distributed float each call — no value is more likely than any other. randomSeed(n) forces the same sequence on every run, making generative results reproducible. Perlin noise, accessed via noise(x), returns values between 0 and 1 but adjacent inputs produce smoothly related outputs, giving organic-looking variation. Moving a noise input slightly (x += 0.01 per frame) produces gentle drift rather than wild jumps. noise() accepts up to three arguments for 2D and 3D noise fields, enabling texture-like variation across a canvas.

Examples

// Choppy: random each frame float y = random(100);

// Smooth: noise-driven position float t = 0; void draw() { float y = noise(t)*100; t += 0.01; }

Assessment

Describe the visible difference between a line whose y-position uses random(100) vs noise(t)*100 as t increments. When would you choose each?

“It’s sometimes desirable to include unpredictable numbers in your programs but to force the same sequence of numbers each time the program is run.”
corpus · processing-handbook-no-login-mirror-pdf-reas-and-fry · chunk 34