Skip to content

Never the Same Twice

You'll write a sketch that draws something different every run, give it a seed so you can get any run back, and post ten outputs side by side.

About

Every generative piece starts here: a few shapes, a random() call where you'd normally type a number, and a canvas that surprises you when you refresh. The trap is that a surprise without a seed is gone forever, so the second half of this badge is randomSeed(), which makes run 37 come back exactly when you ask for it. p5.js in the free web editor or Processing on your laptop both work, and either costs nothing. By the end you'll have a grid of ten runs, one of which you like more than the rest, and you'll be able to say why.

At a glance

Per requirement
15 XP
Completion bonus
75 XP
Requirements
5
Takes
One evening
Skill level
Beginner (done it a few times)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own

Requirements

  1. 1
    Draw ten shapes whose position, size and color come from random(). Start from a blank sketch, draw a loop of ten circles or rectangles, and replace every number you'd normally type with a random() range. Keep the canvas at 800 by 800 so your outputs line up later. Take a screenshot of the canvas with the code visible beside it. Photo
  2. 2
    Refresh twenty times and keep the three you like. Save each run with saveCanvas() in p5.js or save() in Processing rather than taking screenshots, so you get the full resolution. Pick three and write one line each on why they work. Post the three in a row. Photo
  3. 3
    Add a seed so any run can come back. Call randomSeed(n), which has the same name in p5.js and Processing, at the top of setup() and put the number in the saved file name, so output 37 is called 37.png and running seed 37 again gives you the same picture. Film yourself re-running one seed and getting the identical output, or post the two files side by side with their names showing. Photo or video
  4. 4
    Push one range too far and show what breaks. Widen a random range, say stroke weight from 1 to 200, and watch the composition fall apart. Narrowing ranges is most of what steering randomness means, and seeing the failure first teaches you where the edge is. Post the broken output next to the tame one. Photo
  5. 5
    Post ten seeded outputs as one grid. Seeds 1 to 10, no cherry picking, laid out in a two by five grid. Any image editor works, or a second sketch that loads the files. Write which seed you'd hang on a wall, which you'd delete, and what rule would have prevented the bad one. Photo