# Bias of first values produced by a family of RNGs

Suppose I'm doing a large number of pseudo-random but deterministic experiments, where each experiment requires generating several random numbers.

I'm approaching this by having each experiment use a random number generator seeded with a random-looking seed - e.g. hash of the index of the experiment. This is especially convenient for parallelizing my experiments.

I'm wondering if this is a sound way to get good randomness. In particular, this article points out at the end that the first value returned by e.g. Java's random generator (LCG) is highly biased even if you vary the seed.

How can I avoid this bias? Is it sufficient to throw away one or two numbers, as that article suggests? Is there any research on this topic? (I wasn't able to find the right keywords)

Would, e.g., Mersenne Twister behave better?

The most critical factor is to choose the pseudo-random number generator wisely, so that its statistical properties are sufficient for the kind of simulations you are doing. Some pseudo-random number generators are especially awful: for instance, on some platforms rand() is terrible (its least significant bit alternates between 0 and 1), and Excel's RAND() has been criticized in the statistical literature. So, choose wisely. But this issue is more a matter of choosing a suitable pseudo-random generator, which is something you need to do anyway.
It's important to include the hashing step. If you don't do that, then you're feeding closely related seeds into the pseudo-random generators. For some pseudo-random generators, bad things might happen: you might get closely related outputs. For instance, that's exactly what the article you mentioned is warning about, when you use Java's Math.random(). Using a good hash function will fix this, because now the seeds to the pseudo-random generator will look unrelated (each bit will be different with probability about 1/2, etc.).