Based on: Gaussian Distribution by Kerry Jones, 1977
Category: experimental
Description:
Minimal changes from the direct translation, but there's something wonderful about watching the madness eat at your screen. This sketch is running in the browser.
/* Part of the ReCode Project (http://recodeproject.com) Based on "Gaussian Distribution" by Kerry Jones Originally published in "Computer Graphics and Art" v2n2, 1977 Copyright (c) 2013 Josh Giesbrecht - OSI/MIT license (http://recodeproject/license). */ // coded by Josh Giesbrecht color fg = color(0,10,30); color bg = color(255, 20); void setup() { size(400,400); smooth(); background(bg); update(); } void draw(){ update(); } void update() { //background(255); fill(bg); rect(0,0,400,400); for (int i=0; i<7000; i++) { int x = (int)random(0,width); int y = floor((int)(myGaussian() * height*0.18)) + height*4/9; //int y = (int)random(0,400); //int y = (int)(rnd.nextGaussian() * 10) + 200; noStroke(); fill(fg); ellipse(x, y, 4, 4); } } // ported from http://www.colingodsey.com/javascript-gaussian-random-number-generator/ float myGaussian() { float x1, x2, rad; do { x1 = 2 * random(1) - 1; x2 = 2 * random(1) - 1; rad = x1 * x1 + x2 * x2; } while(rad >= 1 || rad == 0); float c = sqrt(-2 * (float)Math.log(rad) / rad); return x1 * c; };