Skip to main content
My Blog

Nature of code - Randomness

Currently working though Daniel Shiffman's The Nature of Code.

The book's spiel: "How can we capture the unpredictable evolutionary and emergent properties of nature in software? How can understanding the mathematical principles behind our physical world help us to create digital worlds? This book focuses on the programming strategies and techniques behind computer simulations of natural systems using Processing."

Sounds good to me 😎

I'm going to dump my sketches here:

Exercise 0.1 - Create a random walker that has a greater tendency to move down and to the right.

Exercise 0.3 - Create a random walker with dynamic probabilities. For example, can you give it a 50 percent chance of moving in the direction of the mouse?

Exercise 0.4 - Consider a simulation of paint splatter drawn as a collection of colored dots. Most of the paint clusters around a central position, but some dots splatter out toward the edges. Can you use a normal distribution of random numbers to generate the positions of the dots? Can you also use a normal distribution of random numbers to generate a color palette? Try creating a slider to adjust the standard deviation.

Exercise 0.5 - A Gaussian random walk is defined as one in which the step size (how far the object moves in a given direction) is generated with a normal distribution. Implement this variation of the Walker class.

I added a 2nd Walker and inversed the colours - to make it more interesting.