Default Java Library
in
Programming Questions
•
7 months ago
Hello,
I'm working through Shiffman's Nature of Code book, and quite early on he is making use of Processing's default Java library and the Random function, along with nextGaussian. These work fine in Processing 1.5.1 but I can't seem to get them to work at all in Processing 2.0b8. I'm guessing it should work, as the Java library should still be there?
Here is the sketch:
- Random generator;
- void setup() {
- size(640, 640);
- generator = new Random();
- background(255);
- }
- void draw(){
- float numx = (float) generator.nextGaussian();
- float numy = (float) generator.nextGaussian();
- float sd = 60;
- float mean = 320;
- float x = sd * numx + mean;
- float y = sd * numy + mean;
- noStroke();
- fill(0,10);
- ellipse(x,y,16,16);
- }
Thanks for any help,
Josh
1