Posted By

pablazo on 10/13/07


Tagged

java random


Versions (?)

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


 / Published in: Java
 

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

  1. public static int randomNumber(int min, int max) {
  2. return min + (new Random()).nextInt(max-min);
  3. }

Report this snippet  

You need to login to post a comment.