Method Random
Random()
Returns an infinite sequence of random integers.
Declaration
public static IEnumerable<int> Random()
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Random(Random)
Returns an infinite sequence of random integers using the supplied random number generator.
Declaration
public static IEnumerable<int> Random(Random rand)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | rand | Random generator used to produce random numbers |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Random(int)
Returns an infinite sequence of random integers between zero and a given maximum.
Declaration
public static IEnumerable<int> Random(int maxValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | maxValue | Exclusive upper bound for random values returned. |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Random(Random, int)
Returns an infinite sequence of random integers between zero and a given maximum using the supplied random number generator.
Declaration
public static IEnumerable<int> Random(Random rand, int maxValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | rand | Random generator used to produce values |
| int | maxValue | Exclusive upper bound for random values returned |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Random(int, int)
Returns an infinite sequence of random integers between a given minimum and maximum.
Declaration
public static IEnumerable<int> Random(int minValue, int maxValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | minValue | Inclusive lower bound for random values returned. |
| int | maxValue | Exclusive upper bound for random values returned. |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
Random(Random, int, int)
Returns an infinite sequence of random integers between zero and a given maximum using the supplied random number generator.
Declaration
public static IEnumerable<int> Random(Random rand, int minValue, int maxValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Random | rand | Random generator used to produce values |
| int | minValue | Inclusive lower bound for random values returned. |
| int | maxValue | Exclusive upper bound for random values returned |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> | An infinite sequence of random integers |
Remarks
This operator uses deferred execution and streams its result.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentOutOfRangeException |
|