Class RandomExtensions
SC4X System.Random extensions
public static class RandomExtensions
- Inheritance
-
RandomExtensions
- Inherited Members
Methods
NextBool(Random)
Why in the fuck does System.Random not have a NextBool method!!??? It's literally not hard and it's super useful.
public static bool NextBool(this Random random)
Parameters
random
Random
Returns
NextGuass(Random)
Unfortunately not a true guassian distribution. It produces a float value from -1.0 to 1.0 For the life of me I cannot figure out what the name would be for this value otherwise, but I have experienced guassians as the same range so it's a naming approximation. If some super smart math person wants some free headpats I'd love to know what this is supposed to be called!!!
public static float NextGuass(this Random random)
Parameters
random
Random
Returns
NextRange(Random, int, int)
public static int NextRange(this Random random, int max, int min = 0)
Parameters
Returns
PercentChance(Random, float)
Calculates a boolean based on a percent chance that it is true. Useful for simulating "dice rolls"
public static bool PercentChance(this Random random, float percent)