3 ms·
Maybe "usable" is your qualifier but what's wrong with Math.random()?
by noman-land 1y ago
Maybe "usable" is your qualifier but what's wrong with Math.random()?
- tsujp 1y agoJS also has Crypto.getRandomValues()
- akdev1l 1y agoTo generate random number in a specific range you need to do something I always forget and need to google. Math.floor(Math.random() * (max - min + 1)) + min; (Google AI summary says this is the thing) 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()
- sdenton4 1y agoWhy not add a Math.randint? I imagine there's some deep ideological war over whether to add more programming functionality to css...
- ameliaquining 1y agoCurrently under discussion in the standards committee: https://tc39.es/proposal-random-functions/ https://tc39.es/proposal-random-functions/
- ameliaquining 1y agoMath.floor(Math.random() * Math.floor((max - min) / step)) * step + min