Class Random
can be instantiated using a constructor without parameters and MSDN says that in this case it is seeded with some time-dependent value.
Is the way to derive that time-dependent value documented anywhere? Can I reproduce it?
It's not documented, and I think that's on purpose. I don't see any good reason why something like this should be documented and the framework implementers should be able to choose how exactly to do this.
But if you want to know how does it work currently, just use ildasm or Reflector. Reflector will give you this (.Net 4.5 beta):
public Random() : this(Environment.TickCount)
{
}
If you look at the source code of mono, you will see that since 2003, it does exactly the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With