You're using two instances of the Random
class. Using the parameterless constructor, the the random number generator is seeded using a system clock based value.
This means that if you're creating two Random
instances shortly after each other, they will be initialized using the same value, because the system clock has a finite resolution. Having the same seed means that these two instances will produce the same sequence of results.
Some Googling revealed that using Random
cross-thread can cause it to break and return an endless sequence of zeros, so if you have to multi-thread this particular part of the code, you may want to look at this article on how to create a single thread safe version of the Random
class.