Another important way to simulate randomness is using Perlin noise generation. Perlin noise generation differs from random generation as it uses a “smooth” sequence of psuedo random numbers, where a singular value in a sequence depends on its predecessors. This is especially useful in creating natural phenomena such as clouds and the textures of materials like marble or wood. Take these examples;
This example assigns a random brightness to each pixel on the screen. Notice how dark pixels are adjacent to light ones, creating a grainy texture.
However this sketch assigns a random brightness to each pixel on the screen using Perlin noise. As the brightness value of each pixel depends on its neighbours, clumps of brightness and darkness form.
To carry on from the Processing work we did in class, I began to read the book The Nature of Code and start some of the exercises within it.
The aim of the book is to teach the reader how to program how to model a digital “ecosystem” using concepts from biology and physics. I chose to look into this book to learn some more advanced programming skills and hopefully I can complete most of the assignements.
To start off the book talks about normal distribution and how in nature variable information usually lies along a bell curve. For example take people’s heights. The height of people can vary greatly, but if you looked at everyone’s heights as a data set, more people would be near the average height than at the two extremes. The mathematics behind this is called Gaussian distribution.
The equations for this are included in the Java library and a version of this is included in Processing. Take for example this code which uses Gaussian distribution to place white dots around a particular point.
The lines generator.nextGaussian() creates a Gaussian distribution with ysd and xsd being the standard deviation and xmean and ymean being the mean. The circles are semi transparent so one can see the brighter areas near the middle where more of the dots are clustered, whereas on the outside the dots are more faint as they are less likely to be placed there.
Shiffman, D., 2012. The Nature of Code [online] Mountain View: Creative Commons.