Mono Class Library: System.Random Overview | Members

System.Random.NextBytes Method

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

public virtual void NextBytes (byte[] buffer)

Parameters

buffer
An array of bytes to be populated with random numbers. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionbuffer is a null reference. [Edit]

Remarks

Operation
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 byte.MaxValue.

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

Usage
Use the NextByte method to populate a byte array with random numbers.

[Edit]

Requirements

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