System.Random.Sample Method

Returns a random floating-point number between 0.0 and 1.0.

Syntax

protected virtual double Sample ()

Returns

A double-precision floating point number greater than or equal to 0.0, and less than 1.0.

Remarks

To produce a different random distribution or a different random number generator principle, derive a class from the Random class and override the Random.Sample method.

Note:

The Random.Sample 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 Random.NextDouble method.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0