Updated RandomExtentions (markdown)

Stone_Red
2022-05-20 18:46:04 +02:00
parent 66ff5cae92
commit 83c97f7af8
+7 -8
@@ -22,25 +22,24 @@
* NextBool * NextBool
* Description: Returns a random bool using the "Random" class * Description: Returns a random bool using the "Random" class
* Parameters: `this Random random`, `IEnumerable<T> collection` * Parameters: `this Random random`
* Example usage: * Example usage:
```cs ```cs
string[] arr = { "test1", "test2", "test3" };
Random rnd = new Random(); Random rnd = new Random();
string randomItem = rnd.NextItem(arr); string randomBool = rnd.NextBool();
Console.WriteLine(randomItem); Console.WriteLine(randomBool);
``` ```
* Output (Will be random every time): * Output (Will be random every time):
```text ```text
test2 true
``` ```
* NextEnum\<T> * NextEnum\<T>
* Description: Returns a random bool using the "Random" class * Description: Returns a random bool using the "Random" class
* Parameters: `this Random random`, `IEnumerable<T> collection` * Parameters: `this Random random`, `Enum`
* Example usage: * Example usage:
```cs ```cs
@@ -54,8 +53,8 @@
... ...
Random rnd = new Random(); Random rnd = new Random();
MyEnum randomItem = rnd.NextEnum(new MyEnum()); MyEnum randomEnum = rnd.NextEnum(new MyEnum());
Console.WriteLine(randomItem); Console.WriteLine(randomEnum);
``` ```
* Output (Will be random every time): * Output (Will be random every time):