Randomness

The lamp implements a 'party' mode, which randomizes the next color and the time for which that color will be displayed before the next color change. The code uses an efficient parallel bit implementation of a Galois linear shift register. However, unless a random seed value can be acquired, the sequence will be the same each and every time.

Truly random

The PIC16 has no PRNG (pseudo-random number generator). An approach to simulating a PRNG is to use the ADC to capture from an unused pin. The assumption is that noise present in the last least significant bit or so of the result can be summed to generate a pseudo-random number. No testing was done to attempt to quantify the quality of this methodology, but it certainly provides some amount of randomness and is adequate for the simple needs of this project.