mirror of
https://github.com/KingKDot/PowerCrypt
synced 2026-06-06 16:04:30 +00:00
22 lines
797 B
C#
22 lines
797 B
C#
namespace PowerCrypt.Obfuscator.Methods.RandomHelper
|
|
{
|
|
public class Helper
|
|
{
|
|
public static string GetRandomString(int length)
|
|
{
|
|
Random random = new Random();
|
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
return new string(Enumerable.Repeat(chars, length)
|
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
|
}
|
|
|
|
public static string GetRandomString(int length, bool onlyLetters)
|
|
{
|
|
Random random = new Random();
|
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
return new string(Enumerable.Repeat(chars, length)
|
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
|
}
|
|
}
|
|
}
|