home
|
featured sketchers
|
gallery
write a sketch
|
community
|
Copy sketch
Write your sketch here
Need inspiration? Play with some examples
here
or check the Processing language
reference
// just type here // and click "submit" when done void setup() { size(600,600); smooth(); fill(255,0,0,70); noStroke(); } void draw() { //background(255,255,255,10); // Draw points for( int i = 0; i < 100; i++ ) { float distance = 300.0 - abs(randomNormal()) * 50; float angle = random(0,2*PI); int x = int(distance * cos(angle)); int y = int(distance * sin(angle)); ellipse(width/2+x,height/2+y,4,4); } } // Implements the Marsaglia Polar Method, as described in wikipedia, but only returns one of the values. // float randomNormal() { float x = 1.0, y = 1.0, s = 2.0; // s = x^2 + y^2 while(s >= 1.0) { x = random(-1.0f, 1.0f); y = random(-1.0f, 1.0f); s = x*x + y*y; } return x * sqrt(-2.0f * log(s)/s); }
Sketches you submit on sketchPatch will be licensed under the
Creative Commons Attribution 3.0 Unported License
. If you upload code based on other people's work, please check the licence compatibility.
Title
Tags
Publish
let other people see your sketch
Your comments about the sketch
This one is kind of useful cause includes a normal gaussian number generator that I found on the processing forum.