BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object

Generates psuedo-random numbers.

Instances of this class are initialized using a "seed", or starting value. The series of numbers generated by instances of the class are repeatable: given the same seed value, all instances of this class generate the same series of numbers.

The numbers generated by this class are chosen with equal probability from a finite set of numbers. The numbers are generated by a definite mathematical algorithm and are therefore not truly random, but are sufficiently random for practical purposes. For this reason, the numbers are considered to be psuedo-random.

- Constructor

  Constructs a new instance of the class using as the seed value.

  This constructor is equivalent to ( ).

  When generating random numbers on high performance systems, the system clock value might not produce the desired behavior. For details, see the ( ) constructor.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A used as the starting value for the pseudo-random number sequence.

  Constructs a new instance of the class using the specified seed value.

  To construct instances that produce different random number sequences, invoke this constructor using different seed values such as might be produced by the system clock. Note, however that on high performance systems, the system clock might not change between invocations of the constructor, in which case the seed value will be the same for different instances of . When this is the case, additional operations are required to have the seed values differ in each invocation.

  The following example demonstrates using a bitwise complement operation to obtain different random numbers using a time-dependent seed value on high performance systems.

  using System; class RandomTest { public static void Main() { Random rand1 = new Random(); Random rand2 = new Random(Environment.TickCount); Console.WriteLine("The random number is {0}",rand1.Next()); Console.WriteLine("The random number is {0}",rand2.Next());

  Random rdm1 = new Random(unchecked(Environment.TickCount)); Random rdm2 = new Random(~unchecked(Environment.TickCount)); Console.WriteLine("The random number is {0}",rdm1.Next()); Console.WriteLine("The random number is {0}",rdm2.Next()); } }

  The output is

  The random number is 1990211954

  The random number is 1990211954

  The random number is 1990211954

  The random number is 964628126

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Int32

  Returns a psuedo-random number between 0 and .

  A greater than or equal to zero and less than .

  As described above.

  Override this method to customize the algorithm used to generate the return value.

  The following example demonstrates using the method. The output generated by this example will vary.

  `using System; class RandomTest { public static void Main() { Random rand1 = new Random(); for (int i = 0; i<10;i++) Console.WriteLine("The random number is {0}",rand1.Next()); } }`

  The output is

  The random number is 1544196111

  The random number is 181749919

  The random number is 1045210087

  The random number is 1073826097

  The random number is 1533078806

  The random number is 1083151645

  The random number is 569083504

  The random number is 1711370568

  The random number is 578178313

  The random number is 409444742

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Int32 `` The upper bound of the random number to be generated. is required to be greater than or equal to zero.

  Returns a psuedo-random positive number less than the specified maximum.

  A set to a psuedo-random value greater than or equal to zero and less than . If is zero, returns zero.

  As described above.

  Override this method to customize the algorithm used to generate the return value.

  Use this method to generate a psuedo-random number less than the specified maximum value.

  is less than zero. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Int32 `` `` The lower bound of the random number returned. The upper bound of the random number returned.

  Returns a psuedo-random number within a specified range.

  A psuedo-random number greater than or equal to and less than . If and are equal, this value is returned.

  As described above.

  Override this method to customize the algorithm used to generate the return value.

  Use this method to generate psuedo-random numbers in a specified range.

  is greater than . 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` An array of bytes to be populated with random numbers.

  Populates the elements of a specified array of bytes with random numbers.

  Each element of the array of bytes is set to a random number greater than or equal to zero, and less than or equal to .

  Override this method to customize the algorithm used to generate the return value.

  Use the method to populate a array with random numbers.

  is a reference. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Double

  Returns a random number between 0.0 and 1.0.

  A greater than or equal to 0.0, and less than 1.0.

  As described above.

  Use this method to generate a psuedo-random number greater than or equal to zero, and less than one.

  1
  ExtendedNumerics
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Double To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)