Math.random will give you a floating point number between 0 (inclusive) and 1 (exclusive).
Multiplying this by 256, you get a number in the range from 0 (inclusive) to 256 (exceptional), but still a floating point.
Taking the word of this number, you get an integer from 0 to 255 (both inclusive).
This is an integer from 0 to 255, which you need to create RGB values ββsuch as rgb(72,25,183).
source
share