DEV Community

loading...

Discussion on: How do you do random?

Collapse
jckuhl profile image
Jonathan Kuhl
const random = (max, min=0) => Math.floor(Math.random() * (max - min)) + min

I wish JS had a more inuitive means of doing random, a built in RandInt function like Python has. Ah well.

Still beats having to make an entire object just for a random number Java.