Multicolor light display

Well the equation actually works out. It makes it so that the total power outputed is ~93 (because 3*31 is 93). Basically if all the values are 1024 then:

ratio = 31*3/1024+1024+1024   //ratio equals ~0.03
then analogWrite(led, Values[any_value]*ratio)  //note the *ratio. So Values[any_value]*ratio = 1024*0.03 = 30.72

Also works if all the values = 1

ratio = 31*3/1+1+1 //ratio equals 31
analogWrite(write, Values[any_value]*ratio)  //Values[any_value]*ratio = 1 * 31 = 31

Now if we had extreme values above 1024 we might have a problem. But that won't happen outside of a programming bug.
I'm actually really proud of coming up with the formula for this. :3

Anyway, I totally didn't think about the possibility of a 0 denominator. I'll make sure to fix it.

And a little addition info. I accidentally set the randomizer to only out put 0. And it still flickers(though it doesn't change color.) I'll plug something into the serial monitor to check values sometime tomorrow.

Thanks for the help.