Actionscript:
-
for (var i:int = 0; i<100; i++){
-
graphics.lineStyle(0,0);
-
graphics[["drawEllipse", "drawRect"][int(Math.random()*2)]](Math.random()*400, Math.random()*300, Math.random()*100,Math.random()*100)
-
}
-
-
/*
-
WARNING: This code was written for fun. Use at your own risk.
-
*/
And a more readable version:
Actionscript:
-
var methodChoices:Array = ["drawEllipse", "drawRect"];
-
var method:String;
-
var xp:Number, yp:Number, w:Number, h:Number;
-
for (var i:int = 0; i<100; i++){
-
method = methodChoices[int(Math.random()*methodChoices.length)];
-
graphics.lineStyle(0,0);
-
xp = Math.random()*400;
-
yp = Math.random()*300;
-
w = Math.random()*100;
-
h = Math.random()*100;
-
graphics[method](xp, yp, w, h)
-
}
-
-
/*
-
WARNING: This code was written for fun. Use at your own risk.
-
*/
Here I use yesterdays associative array function call technique to do something different. Not really all that useful, but interesting....