-
-
Save ff6347/54387f5aecd3d66c4b95d7904da4bd57 to your computer and use it in GitHub Desktop.
https://www.openprocessing.org/sketch/62168 Random Distribution In Circle – Homogeneous by FELD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setup() { | |
| createCanvas(500, 500); | |
| smooth(); | |
| } | |
| function draw() { | |
| background(255); | |
| noStroke(); | |
| fill(0); | |
| ellipseMode(CENTER); | |
| translate(width/2, height/2); | |
| randomSeed(99); // Immer die gleiche Zufallsfolge | |
| var numberOfDots = 4000; | |
| var radius = 180; | |
| for (var j = 0; j < numberOfDots; j++) { | |
| var randomangle = random(0, TWO_PI); // Zufaelliger Winkel von 0 - 360 Grad | |
| var randomradius = radius * sqrt(random(0, 1)); // Homogene Verteilung | |
| var x = -sin(randomangle) * randomradius; | |
| var y = cos(randomangle) * randomradius; | |
| ellipse(x, y, 5, 5); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment