summaryrefslogtreecommitdiffstats
path: root/src/IOL.Helpers/RandomStringGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/IOL.Helpers/RandomStringGenerator.cs')
-rw-r--r--src/IOL.Helpers/RandomStringGenerator.cs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/IOL.Helpers/RandomStringGenerator.cs b/src/IOL.Helpers/RandomStringGenerator.cs
index 0d691db..2f39d67 100644
--- a/src/IOL.Helpers/RandomStringGenerator.cs
+++ b/src/IOL.Helpers/RandomStringGenerator.cs
@@ -1,18 +1,17 @@
using System;
using System.Linq;
-namespace IOL.Helpers
+namespace IOL.Helpers;
+
+public static class RandomString
{
- public static class RandomString
- {
- private static readonly Random _random = new Random();
+ private static readonly Random _random = new();
- public static string Generate(int length, bool numeric = false) {
- var chars = numeric switch {
+ public static string Generate(int length, bool numeric = false) {
+ var chars = numeric switch {
false => "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
true => "0123456789"
- };
- return new string(Enumerable.Repeat(chars, length).Select(s => s[_random.Next(s.Length)]).ToArray());
- }
+ };
+ return new string(Enumerable.Repeat(chars, length).Select(s => s[_random.Next(s.Length)]).ToArray());
}
-} \ No newline at end of file
+}