 <p>Random is a <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator" rel="nofollow">linear congruential generator</a>; i.e. it is based on a formula of the form:</p> <pre><code>N &lt;- (N * C1 + C2) % M </code></pre> <p>where C1, C2 and M are constants.</p> <p>One of the properties of this class of generator is that has high auto-correlation. Indeed, if you plot successive numbers you can see clear stripping patterns in the numbers.</p> <p>Your test program has effectively taken 10 successive numbers from the underlying generator, calculated their value modulo 10 ... and found that they are all the same. Effectively, the modulo 10 is "resonating" with the natural periodicity of the generator ... over a short period of time.</p> <p>This is one of the downsides of using a PRNG with high auto-correlation. In layman's terms ... it is "not very random" ... and you can get into trouble if you use it in a situation where randomness is critical.</p> <hr> <p>Notes:</p> <ul> <li>Random is not a random number generator. It is a <em>pseudo-random</em> number generator. That means that if you know the initial state, the numbers generated are entirely predictable.</li> <li>Using a true random seed for Random doesn't really help. It just makes the problem harder to reproduce.</li> <li>There are likely to be other seeds for Random that will give you similar patterns with this particular test.</li> <li>From a purely mathematical standpoint, ten ones is no more or less "random" than any other sequence of ten numbers. But from a mathematical perspective, <code>Random</code> is not random at all. In fact, it is totally predictable once you have figured out what the current value of <code>N</code> is. The problem is the auto-correlation that is making the sequence appear intuitively non-random.</li> <li>If you want to avoid this kind of intuitive non-randomness, use SecureRandom which should either be a true random number source, or a generator of pseudo-random numbers that are much, much harder to predict.</li> </ul>