color change in the lamp and the sphere - synchronously

Question
there is a sphere and a light source
dynamically randomly synchronously changing the color of the lamp and the sphere
why the lamp and the sphere have a different color, although they change simultaneously.

I solved the problem
added a variable and now everything works synchronously