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.

4
  • This seems to just repeat the existing answers from 5 years prior (use Random() and .Next()). Commented Jul 8, 2022 at 21:00
  • 1
    @TylerH, yes but at least this explains that the lower bound is inclusive and the upper bound is exclusive. That's not something obvious, so the original example leaves it unclear if the actual random number range is from 0-100, 1-100, 0-99, or 1-99 Commented Dec 27, 2023 at 0:10
  • Couldn't the top answer just have been edited? Thats kinda the point of editing. Commented Jul 9, 2024 at 8:50
  • 1
    I'm glad he provided this example, he is absolutely correct about the ambiguity of the lower and upper bounds in the other answers Commented Sep 23, 2024 at 0:50