Skip to content

Instantly share code, notes, and snippets.

@josues
Created November 26, 2016 20:57
Show Gist options
  • Select an option

  • Save josues/86ea845d5db1ab52b52a1e3a00540138 to your computer and use it in GitHub Desktop.

Select an option

Save josues/86ea845d5db1ab52b52a1e3a00540138 to your computer and use it in GitHub Desktop.
Processing to P5 ?
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);
}
}
@ff6347
Copy link

ff6347 commented Nov 27, 2016

This should work. See the image.
bildschirmfoto 2016-11-27 um 18 36 35

BTW it's good to add a link to the original work. Like --> https://www.openprocessing.org/sketch/62168 Random Distribution In Circle – Homogeneous by FELD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment