Math.floor(Math.random() * (max - min + 1)) + min;
The CSS function would be random(min, max)
Also the CSS function seems to take a number of steps, it is not immediately obvious to me how to do that with Math.random()
I imagine there's some deep ideological war over whether to add more programming functionality to css...
Math.floor(Math.random() * Math.floor((max - min) / step)) * step + min