Class RandomExtensions
Extensions for the Random class.
Inherited Members
Namespace: TheXDS.MCART.Types.Extensions
Assembly: MCART.dll
Syntax
public static class RandomExtensions
Properties
| Edit this page View SourceRnd
Ensures that functions requiring random numbers don't generate Random objects with the same time-based seed.
Declaration
public static Random Rnd { get; }
Property Value
Type | Description |
---|---|
Random |
Methods
| Edit this page View SourceCoinFlip(Random)
Declaration
public static bool CoinFlip(this Random r)
Parameters
Type | Name | Description |
---|---|---|
Random | r | Instance of the Random object to use. |
Returns
Type | Description |
---|---|
bool |
Next(Random, in Range<int>)
Returns a random integer within the specified range.
Declaration
public static int Next(this Random r, in Range<int> range)
Parameters
Type | Name | Description |
---|---|---|
Random | r | Instance of the Random object to use. |
Range<int> | range | Range<T> of numbers to select from. |
Returns
Type | Description |
---|---|
int | A random integer within the specified range. |
RndText(Random, in int)
Gets a random text string.
Declaration
public static string RndText(this Random r, in int length)
Parameters
Type | Name | Description |
---|---|---|
Random | r | Instance of the Random object to use. |
int | length | Length of the string to generate. |
Returns
Type | Description |
---|---|
string | A random text string with the specified length. |