Question regarding Math.floor(Math.random())

Hello everyone,
I’m doing the javascript part III module and at the inheritance / static method, I need to generate a password who’s an integer between 0 and 10 000.

The solution tells us to use : Math.floor(Math.random() * 10000)

Isn’t this code max number would be 9999 ? I would use Math.floor(Math.random() * 10001). What do you guys think ? Maybe it is not a big deal but hey, I’m trying to be… meticulous lets’ say.

Thanks you

If the task is to generate an integer between 0 and 10 000, it probably means that 10 000 is not included.

Makes sense. Thanks!

1 Like