You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
686 B
28 lines
686 B
namespace DealerSelection.Api.CommonUtil
|
|
{
|
|
public static class GenerateRandomString
|
|
{
|
|
public static string GenerateString(int lgth)
|
|
{
|
|
string random = "";
|
|
try
|
|
{
|
|
Random ran = new Random();
|
|
string b = "abcdefghijklmnopqrstuvwxyz";
|
|
int length = lgth;
|
|
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
int a = ran.Next(26);
|
|
random = random + b.ElementAt(a);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return random;
|
|
}
|
|
}
|
|
|
|
}
|