J
John E
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));
}
I need to act upon the results of this generator with more random numbers,
but unfortunately it seems to produce the same results the second time
therefore losing any element of apparent randomness.
TIA.
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));
}
I need to act upon the results of this generator with more random numbers,
but unfortunately it seems to produce the same results the second time
therefore losing any element of apparent randomness.
TIA.