Skip to content
JuDelCo edited this page May 20, 2021 · 3 revisions

Namespace: Ju.Random

RandomGenerator

// Constructor
RandomGenerator(int seed);

void ChangeSeed(int seed);

// + All the methods listed below for the Random static class

Random (static class)

NewGenerator() creates a new object with a custom seed with all the methods the Random static class has.

SetDefaultSeed() changes the seed for all the methods in the Random static class.

RandomGenerator NewGenerator(int seed);
void SetDefaultSeed(int seed);

// Bool
bool Bool();
bool Bool(float probability01);

// Int
int Int();
int Int(int max);
int Int(int min, int max);

// Float
float Float01();
float Float(float max);
float Float(float min, float max);

// String
string Guid();

// IList
void ListShuffle<T>(IList<T> list);
T ListElement<T>(IList<T> list);
IEnumerable<T> ListElements<T>(IList<T> list, int iterations);
IEnumerable<T> ListElementsUnique<T>(IList<T> list);
IEnumerable<T> ListElementsUnique<T>(IList<T> list, int maxIterations);
T ListRemoveElement<T>(IList<T> list);

// IDictionary
TValue DictionaryElement<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
IEnumerable<TValue> DictionaryElements<TKey, TValue>(IDictionary<TKey, TValue> dictionary, int iterations);
IEnumerable<TValue> DictionaryElementsUnique<TKey, TValue>(IDictionary<TKey, TValue> dictionary);
IEnumerable<TValue> DictionaryElementsUnique<TKey, TValue>(IDictionary<TKey, TValue> dictionary, int maxIterations);
TValue DictionaryRemoveElement<TKey, TValue>(IDictionary<TKey, TValue> dictionary);

// Color
Color Color();
Color Color(float hueMin, float hueMax);
Color Color(float hueMin, float hueMax, float saturationMin, float saturationMax);
Color Color(float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax);
Color Color(float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax, float alphaMin, float alphaMax);

// Color32
Color32 Color32();
Color32 Color32(float hueMin, float hueMax);
Color32 Color32(float hueMin, float hueMax, float saturationMin, float saturationMax);
Color32 Color32(float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax);
Color32 Color32(float hueMin, float hueMax, float saturationMin, float saturationMax, float valueMin, float valueMax, float alphaMin, float alphaMax);

IList Extensions

void Shuffle<T>();
T RandomElement<T>();
IEnumerable<T> RandomElements<T>(int iterations);
IEnumerable<T> RandomElementsUnique<T>();
IEnumerable<T> RandomElementsUnique<T>(int maxIterations);
T RandomRemoveElement<T>();

IDictionary Extensions

TValue RandomElement<TKey, TValue>();
IEnumerable<TValue> RandomElements<TKey, TValue>(int iterations);
IEnumerable<TValue> RandomElementsUnique<TKey, TValue>();
IEnumerable<TValue> RandomElementsUnique<TKey, TValue>(int maxIterations);
TValue RandomRemoveElement<TKey, TValue>();
Clone this wiki locally