Skip to content

Instantly share code, notes, and snippets.

@ff6347
Forked from josues/translation.js
Last active November 27, 2016 17:38
Show Gist options
  • Select an option

  • Save ff6347/54387f5aecd3d66c4b95d7904da4bd57 to your computer and use it in GitHub Desktop.

Select an option

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
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