Fixing Random

Fixing Random

First, every time is called, we create a new , but in most of the implementations of Random available for the last couple decades, by default it seeds itself with the current time, and the granularity of the timer is only a few milliseconds. In those versions, a new Random() now seeds itself randomly, rather than based on the current time. Coming up on FAIC: We will start by simply improving the existing implementation of Random, but from that humble beginning we’ll develop a new class library that makes programming with probabilities much more readable, powerful and efficient in C#.

Source: ericlippert.com

Leave a Reply

Your email address will not be published. Required fields are marked *