2008年4月7日 星期一

random


void setup() {

size(800, 600);

background(255);

noLoop();

}
void draw(){

for(int i=0;i<400;i++)
{
float x,y,lx,ly,a,b,c,d;// Random rand = new Random();
a = random(0,255);
b = random(0,255);
c = random(0,255);
d = random(0,255);
x = random(0,800);
y = random(0,600);
lx = random(0,100);
ly = random(0,100);
fill(a,b,c,d);
rect(x,y,lx,ly);
}
}

沒有留言: