There are lots of clever one-liners for generating random colors:
'#' + Math.floor(Math.random()*16777215).toString(16);
Unfortunately, this code naturally produces lots of greys and browns and murky greens.
randomColor generates attractive colors by default. More specifically, randomColor produces bright colors with a reasonably high saturation. This makes randomColor particularly useful for data visualizations and generative art.