DekGenius.com
[ Team LiB ] Previous Section Next Section

RandomCF 1.0, ECMA 1.0, serializable

System (mscorlib.dll)class

This class encapsulates a pseudorandom number (one chosen from a list of pregenerated numbers, but that is statistically random). After creating an instance of this class, use the Next( ), NextDouble( ), or NextBytes( ) methods to return random information. NextDouble( ) returns a fraction value between 0.0 and 1.0, while Next( ) returns an integer between and the maximum bound that you specify. NextBytes( ) fills a supplied array of bytes with random numbers.

When creating a Random object, you supply a seed value to the constructor, which determines the place on the list from where the random number is drawn. If you supply the same seed value to multiple Random instances, you will receive the same random number. Computers are incapable of generating truly random numbers, and Random should not be used for cryptographic algorithms. For a cryptographically strong random number generator, see the System.Security.Cryptography.RandomNumberGenerator in the .NET Framework SDK Documentation.

public class Random {
// Public Constructors
   public Random( );
   public Random(int Seed);
// Public Instance Methods
   public virtual int Next( );
   public virtual int Next(int maxValue);
   public virtual int Next(int minValue, int maxValue);
   public virtual void NextBytes(byte[ ] buffer);
   public virtual double NextDouble( );
// Protected Instance Methods
   protected virtual double Sample( );
}
    [ Team LiB ] Previous Section Next Section