Re: Generate a random number



Peter MacMillan wrote:
RayKnight wrote:


int num = (new Random()).nextInt(35 - 10) + 10;


just a note that nextInt excludes the upper-bound. So if you wanted to include 35 as a possible result, you'd have to add 1 to it.


ie.
/* ... */.nextInt(max + 1 - min) + min;

--
Peter MacMillan
e-mail/msn: peter@xxxxxxxxxxxxx
.