Table of Contents

Class RandomExtensions

Namespace
Squiggles.Core.Extension
Assembly
SquigglesCommon4X.dll

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

bool

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

float

NextRange(Random, int, int)

public static int NextRange(this Random random, int max, int min = 0)

Parameters

random Random
max int
min int

Returns

int

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)

Parameters

random Random
percent float

the percentage (0.0-1.0) chance of being true

Returns

bool