From: Eric B. R. <eb...@tc...> - 2003-03-27 16:33:55
|
On Thursday, March 27, 2003, at 11:29 AM, kea...@na...=20= wrote: > > I may fail to understand the code, but it seems wrong to me > > so I changed it to > > > > public static final int random(int start, int end) { > >=A0=A0=A0=A0=A0=A0 int iRet =3D start + (int) ((end - start + > > 1)*java.lang.Math.random()); > >=A0=A0=A0=A0=A0=A0 return iRet > end ? end : iRet; > > } > > Your code looks right to me, but the final test is unnecessary, since=20= > Math.random() is always less than 1.0. > > Eric, I think this was your thing.=A0 Do you want to do the fix, or=20 > shall I? If you're in the mood, go ahead. :) I'm snowed under here at the=20 office. eric |