Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 5
    If you take Math.ceil, then +1 can be spared Commented Nov 13, 2020 at 14:12
  • 1
    @AlexanderFarber in that case it would never pick min unless Math.random() returns 0 which is extremely unlikely and would make it weighted. floor and +1 doesn't have this problem because Math.random() will never return 1. Commented May 9, 2024 at 15:43