Random Source Extensions.Next Method
Definition
Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Next( | Returns a non-negative random integer. |
| Next( | Returns a non-negative random integer that is less than the specified maximum. |
| Next( | Returns a random integer that is within a specified range. |
| Next<TGenerator>(IRandomSource<TGenerator>) | Returns a non-negative random integer. |
| Next<TGenerator>(IRandomSource<TGenerator>, Int32) | Returns a non-negative random integer that is less than the specified maximum. |
| Next<TGenerator>(IRandomSource<TGenerator>, Int32, Int32) | Returns a random integer that is within a specified range. |
Next(IRandomSource)
Returns a non-negative random integer.
public static int Next(
this IRandomSource rng
)Parameters
- rng IRandomSource
Return Value
Int32A 32-bit signed integer that is greater than or equal to 0 and less than MaxValue.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Next<TGenerator>(IRandomSource<TGenerator>)
Returns a non-negative random integer.
public static int Next<TGenerator>(
this IRandomSource<TGenerator> rng
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- rng IRandomSource<TGenerator>
Type Parameters
- TGenerator
Return Value
Int32A 32-bit signed integer that is greater than or equal to 0 and less than MaxValue.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Next(IRandomSource, Int32)
Returns a non-negative random integer that is less than the specified maximum.
public static int Next(
this IRandomSource rng,
int maxValue
)Parameters
- rng IRandomSource
- maxValue Int32
- The exclusive upper bound of the random number to be generated. maxValue must be greater than or equal to 0.
Return Value
Int32A 32-bit signed integer that is greater than or equal to 0, and less than maxValue.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Next<TGenerator>(IRandomSource<TGenerator>, Int32)
Returns a non-negative random integer that is less than the specified maximum.
public static int Next<TGenerator>(
this IRandomSource<TGenerator> rng,
int maxValue
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- rng IRandomSource<TGenerator>
- maxValue Int32
- The exclusive upper bound of the random number to be generated.
Type Parameters
- TGenerator
Return Value
Int32A 32-bit signed integer that is greater than or equal to 0, and less than maxValue.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource<TGenerator>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Next(IRandomSource, Int32, Int32)
Returns a random integer that is within a specified range.
public static int Next(
this IRandomSource rng,
int minValue,
int maxValue
)Parameters
- rng IRandomSource
- minValue Int32
- The inclusive lower bound of the random number returned.
- maxValue Int32
- The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.
Return Value
Int32A 32-bit signed integer greater than or equal to minValue and less than maxValue.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IRandomSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Next<TGenerator>(IRandomSource<TGenerator>, Int32, Int32)
Returns a random integer that is within a specified range.
public static int Next<TGenerator>(
this IRandomSource<TGenerator> rng,
int minValue,
int maxValue
)
where TGenerator : struct, new(), IRandomGenerator
Parameters
- rng IRandomSource<TGenerator>
- minValue Int32
- The inclusive lower bound of the random number returned.
- maxValue Int32
- The exclusive upper bound of the random number returned.
Type Parameters
- TGenerator
Return Value
Int32A 32-bit signed integer greater than or equal to minValue and less than maxValue.