RandomExtensions
Namespace: Murder.Utilities
Assembly: Murder.dll
public static class RandomExtensions
⭐ Methods
FlipACoin(Random)
public bool FlipACoin(Random random)
Parameters
random Random
Returns
bool
TryWithChanceOf(Random, float)
public bool TryWithChanceOf(Random random, float chance)
Flag a switch with a chance of
Parameters
random Random
chance float
Returns
bool
TryWithChanceOf(Random, int)
public bool TryWithChanceOf(Random random, int chance)
Flag a switch with a chance of
Parameters
random Random
chance int
Returns
bool
NextFloat(Random, float)
public float NextFloat(Random r, float max)
Returns
float
NextFloat(Random, float, float)
public float NextFloat(Random r, float min, float max)
Parameters
r Random
min float
max float
Returns
float
NextFloat(Random)
public float NextFloat(Random r)
Returns a float from 0f to 1f
Parameters
r Random
Returns
float
SmoothRandom(float, float)
public float SmoothRandom(float seed, float smoothness)
Parameters
seed float
smoothness float
Returns
float
AnyOf(Random, IList)
public T AnyOf(Random r, IList<T> arr)
Parameters
r Random
arr IList<T>
Returns
T
GetRandom(IList, Random)
public T GetRandom(IList<T> array, Random random)
Parameters
array IList<T>
random Random
Returns
T
GetRandom(ImmutableArray, Random)
public T GetRandom(ImmutableArray<T> array, Random random)
Parameters
array ImmutableArray<T>
random Random
Returns
T
GetRandomKey(IDictionary<TKey, TValue>, Random)
public T GetRandomKey(IDictionary<TKey, TValue> dict, Random random)
Parameters
dict IDictionary<TKey, TValue>
random Random
Returns
T
PopRandom(IList, Random)
public T PopRandom(IList<T> list, Random random)
Parameters
list IList<T>
random Random
Returns
T
GetRandom(Random, T[], int)
public T[] GetRandom(Random random, T[] array, int length)
Parameters
random Random
array T[]
length int
Returns
T[]
GetRandom(IDictionary<TKey, TValue>, Random)
public U GetRandom(IDictionary<TKey, TValue> dict, Random random)
Parameters
dict IDictionary<TKey, TValue>
random Random
Returns
U
PopRandom(Dictionary<TKey, TValue>, Random)
public U PopRandom(Dictionary<TKey, TValue> dict, Random random)
Parameters
dict Dictionary<TKey, TValue>
random Random
Returns
U
Direction(Random, float, float)
public Vector2 Direction(Random r, float minAngle, float maxAngle)
This returns a vector one rotated from
Parameters
r Random
minAngle float
maxAngle float
Returns
Vector2
DistributedDirection(Random, int, int, float, float)
public Vector2 DistributedDirection(Random r, int currentStep, int totalSteps, float min, float max)
Parameters
r Random
currentStep int
totalSteps int
min float
max float
Returns
Vector2
DistributedDirection(Random, int, int)
public Vector2 DistributedDirection(Random r, int currentStep, int totalSteps)
Parameters
r Random
currentStep int
totalSteps int
Returns
Vector2
⚡