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.

3
  • 1
    What have you tried and what isn't working as expected? Commented Sep 6, 2022 at 17:52
  • Try to write a custom method, there's no such utility in Java. Also, please try to mention while asking question on what are you trying in code or just asking the idea/approach. Commented Sep 6, 2022 at 18:03
  • 1
    Random r = new Random(); int v = new int [] {r.nextInt(1,20), r.nextInt(30,50), r.nextInt(70,100)}[r.nextInt(0,3)];Note that ranges int java are specified and thus presumed to be inclusive to exclusive. Commented Sep 6, 2022 at 18:20