mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
removing old nature of code examples before adding new ones
This commit is contained in:
-26
@@ -1,26 +0,0 @@
|
||||
// An array to keep track of how often random numbers are picked
|
||||
float[] randomCounts;
|
||||
|
||||
void setup() {
|
||||
size(800,200);
|
||||
randomCounts = new float[20];
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(255);
|
||||
|
||||
// Pick a random number and increase the count
|
||||
int index = int(random(randomCounts.length));
|
||||
randomCounts[index]++;
|
||||
|
||||
// Draw a rectangle to graph results
|
||||
stroke(0);
|
||||
strokeWeight(2);
|
||||
fill(127);
|
||||
|
||||
int w = width/randomCounts.length;
|
||||
|
||||
for (int x = 0; x < randomCounts.length; x++) {
|
||||
rect(x*w,height-randomCounts[x],w-1,randomCounts[x]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user