I'm currently trying to make a random number between -0.5 and 0.5 in this way:
public static double RandomNumberGenerator(long seed)
{
Random r = new Random(seed);
return r.nextDouble() >= 0.5? 0.5 : -0.5;
//PRINTING AND USAGE, SHOULD GO ABOVE
//System.out.println("Object after seed 12222222: " + RandomNumberGenerator(12222222) );
}
Which I then execute like this:
for (int j = 0; j < weights_one.length ; j++)
{
weights_one[j] = RandomNumberGenerator( System.currentTimeMillis() );
}
But it's really dysfunctional, because I always end up with weights that will be the same, i.e.
weights_one[0]: -0.5
weights_one[1]: -0.5
weights_one[2]: -0.5
weights_one[3]: -0.5
weights_one[4]: -0.5
which is not good, they should be gausianly distributed, how can I achieve this?