Get a random number within a given interval -

/ Published in: Java
Save to your folder(s)

Copy this code and paste it in your HTML
  1. public static int randomNumber(int min, int max) {
  2. return min + (new Random()).nextInt(max-min);
  3. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.