
Код AS3:
private function BrightColor():Number {
//0 - Red, 1 - Blue, 2-Green
// первая компонента
var firstComponent:Number = Math.floor(Math.random() * 3);
// вторая компонента
var secondComponent:Number = firstComponent;
while (firstComponent == secondComponent) {
secondComponent = Math.floor(Math.random() * 3);
}
// наш цвет(изначально ЧЕРНЫЙ):
var RGB:Array = new Array(0, 0, 0);
RGB[firstComponent] = 0xFF;
RGB[secondComponent] = Math.floor(Math.random()* 0xFF)
return RGB[0] * 0xFFFF + RGB[1] * 0xFF + RGB[2];
}