Class RandomExtensions
Inheritance
Namespace: TetraCreations.Core
Assembly: cs.temp.dll.dll
Syntax
public static class RandomExtensions
Methods
IsTrueWithProbability(float)
Get a random number between 0f and 1f then check if the probility value is less or equals then the random number
Declaration
public static bool IsTrueWithProbability(float probability)
Parameters
| Type | Name | Description |
|---|---|---|
| float | probability |
Returns
| Type | Description |
|---|---|
| bool |
RollDice(int)
Virtually roll a dice and returns the value of its uppermost side.
Declaration
public static int RollDice(int sideCount = 6)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sideCount | The number of the dice sides. Could be omitted (default value is six). |
Returns
| Type | Description |
|---|---|
| int | Returns random integer from 1 to |
Remarks
A virtual dice consists of sideCount number of
sides. The sides are numbered from 1 to sideCount.
RollDices(int, int)
Virtually roll a dice and returns the value of its uppermost side.
Declaration
public static int[] RollDices(int sideCount = 6, int diceCount = 2)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sideCount | The number of the dice sides. Could be omitted (default value is six). |
| int | diceCount |
Returns
| Type | Description |
|---|---|
| int[] | Returns random integer from 1 to |
Remarks
A virtual dice consists of sideCount number of
sides. The sides are numbered from 1 to sideCount.