Get a random number within a given interval - RefactorMyCode.com


/ 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. }

URL: http://refactormycode.com/codes/35-get-a-random-number-within-a-given-interval

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.