/** This example is similar to week03_normal_2d_random and week03_gaussian_2d_random, but in this case we create a random distribution pattern to position our circles on the screen. */ // Create our RNG CustomRandom rand = new CustomRandom(); void setup() { // setup the environment size(500, 500); background(10); smooth(); colorMode(RGB, 255, 255, 255, 100); // setup the random distribution we'll use, in this case it looks // like hills and troughs float[] distrib = {0.4, 0.01, 0.1, 0.4, 0.4, 0.01, 0.01, 0.4, 0.4, 0.01}; // tell the RNG to use our distribution pattern rand.useDistribution(distrib); } void draw() { // fade out the background fill(10, 10, 10, 1); rect(0, 0, width, height); // set the drawing style for our circles fill(32, 64, 128, 100); // draw 25 circles using numbers from our custom distribution RNG for (int i = 0; i < 25; i++) { ellipse(rand.getRandom(width), rand.getRandom(height), 20, 20); } }