forked from DiscordExploit/DiscordNitroGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGenerateHelper.cs
32 lines (29 loc) · 918 Bytes
/
GenerateHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.IO;
using System.Linq;
namespace NitroChecker
{
internal class GenerateHelper
{
private static Random randomInstance = new Random();
private static char getRandomFromStr(string inputStr) => inputStr[randomInstance.Next(inputStr.Length)];
private static string GenerateRandomCode()
{
string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567891234567891234567891234567891234567891234567";
return new string(Enumerable.Repeat(charset, 16).Select(new Func<string, char>(getRandomFromStr)).ToArray<char>());
}
public static void WriteRandomCodes(int amount)
{
StreamWriter streamWriter = new StreamWriter("codes.txt");
try
{
for (int i = 1; i < amount; i++)
streamWriter.WriteLine(GenerateHelper.GenerateRandomCode());
}
finally
{
((IDisposable)streamWriter).Dispose();
}
}
}
}