Updated RandomExtentions (markdown)

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