topical media & game development
graphic-processing-learning-23-example-23-1-example-23-1.pde / pde
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 23-1: Using java.util.Random instead of random()
Random r;
void setup() {
size(200,200);
// Declaring a Random object and calling the constructor as found at:
// http://java.sun.com/j2se/1.4.2/ docs/api/java/util/Random.html
r = new Random();
frameRate(5);
}
void draw() {
// Calling a function found at:
// http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html
boolean trueorfalse = r.nextBoolean();
if (trueorfalse) {
background(0);
} else {
background(255);
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.