randRange( 0, 255)

Express the decimal number Dec in hexadecimal (base 16) notation.

Dec.toString(16).toUpperCase()

Find the largest power of 16 (i.e., 1, 16, 256) that will go into Dec.

If the largest power is, say, 16, and it goes into Dec 4 times, put a 4 in the sixteens place.

Subtract the largest power of 16 that will go into Dec giving a remainder.

Find the largest power of 16 that will go into the remainder and repeat the above steps until you get to the ones place (16^0).

The answer is Dec.toString(16).toUpperCase()