Random Constructor (Int32)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Initializes a new instance of the Random class, using the specified seed value.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public Random(
	int seed
)

Parameters

seed
Type: System..::..Int32
A number used to calculate a starting value for the pseudo-random number sequence. If a negative number is specified, the absolute value of the number is used.

Providing an identical seed value to different Random objects causes each instance to produce identical sequences of random numbers.

If your application requires different random number sequences, invoke this constructor repeatedly with different seed values. One way to produce a unique seed value is to make it time-dependent. For example, derive the seed value from the system clock. However, the system clock might not have sufficient resolution to provide different invocations of this constructor with a different seed value. This results in random number generators that generate identical sequences of pseudo-random numbers.

Show: