Returns a random floating-point number between 0.0 and 1.0.
Assembly: mscorlib (in mscorlib.dll)
To produce a different random distribution or a different random number generator principle, derive a class from the Random class and override the method.
The method is protected, which means that it is accessible only within the Random class and its derived classes. To generate a random number between 0 and 1 from a Random instance, call the NextDouble method.
Starting with the .NET Framework version 2.0, if you derive a class from Random and override the method, the distribution provided by the derived class implementation of the method is not used in calls to the base class implementation of the following methods:
The Random.NextBytes(Byte) method.
The Random.Next() method.
Instead, the uniform distribution provided by the base Random class is used. This behavior improves the overall performance of the Random class. To modify this behavior to call the implementation of the method in the derived class, you must also override the behavior of these three members. The example provides an illustration.
The following example derives a class from Random and overrides the method to generate a distribution of random numbers. This distribution is different than the uniform distribution generated by the method of the base class.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.