Hi Itzat, it would be simpler to switch the color of one shader, instead of switching between two full shaders.
One way you could do this would be to create a random number, and if it's greater than a certain value, turn green, and less than that value, turn red.
Code:
float $value = rand(0, 100);
if ($value >= 50)
setAttr "material.color" -type double3 1 0 0 ;
else
setAttr "material.color" -type double3 0 1 0 ;
Imagination is more important than knowledge.