1
$\begingroup$

We are generating 5 random numbers for every object we process - this is Java, but the code is pretty easy to follow (docs):

final long millis = System.currentTimeMillis();
final Random random = new Random(millis);

inputData.setRandomNumber1(random.nextDouble());
inputData.setRandomNumber2(random.nextDouble());
inputData.setRandomNumber3(random.nextDouble());
inputData.setRandomNumber4(random.nextDouble());
inputData.setRandomNumber5(random.nextDouble());

This means we instatiate new random number generator for every object using milliseconds as seed. We can say that random numbers 1 to 5 are from uniform random distribution.

After we generate random numbers for many objects, will vector of first, second, third, fourth and fifth random numbers (across objects) also form uniform random distribution?

$\endgroup$
  • 1
    $\begingroup$ If the seeds are drawn at random from a uniform distribution over the range of seeds then this should have no impact. However if you use another seed generator, it would have a clear impact: think of the case when all the five seeds are exactly the same. $\endgroup$ – Xi'an Dec 3 '14 at 15:36
1
$\begingroup$

If pseudorandom number generator (PRNG) works as it should, the answer is yes. You draw multiple samples multiple times from a single uniform distribution. So taking all the first values is just a matter of reordering your samples and if all the draws are independent it should not make a difference. It would make a difference if the draws were not independent, e.g. if the seed had a significant impact on output or if subsequent draws were dependent on each other. So it is a question on how good your PRNG is...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.