"John E" <La-la-> wrote in message
news:bs9606$an9bs$...
> Can someone tell me *two* different ways of randomly generating integers
> between 1 and 3, which will produce *different* results even when run
> simultaneously?
>
> I've been using this (it's not very good though):
>
> private int getRandomNumber(int max)
> {
> Random rand = new Random();
> return (int)(1 + (Math.abs(rand.nextInt()) % 3));
> }
Try this,..
java.util.Random r = new Random();
private int getRandomNumber()
{
return r.nextInt(); // with whatever transforms..
}
Using a single random number generator
is the best way to produce a series of
random numbers..
HTH
--
Andrew Thompson
*
http://www.PhySci.org/ PhySci software suite
*
http://www.1point1C.org/ 1.1C - Superluminal!
*
http://www.AThompson.info/andrew/ personal site