While RGB mode (used by script) is additive color mode, all zero values means pure black color and all three values at 255 means white color...
So, there isn´t too much for programming :-). Looking more carefully to script, first definition part create random color/vector from three values, but if all values keep same number, they are represented as degree shade of grey...Randomness is created for first value (R) and other two has simply same value.
In attached picture are marked differencies in scripts...