Try below..
using System.Text;
using System.IO;
static int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
private string RandomString(int size)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
builder.Append(ch);
}
return builder.ToString();
}
static class RandomUtil
{
public static string GetRandomString()
{
string path = Path.GetRandomFileName();
path = path.Replace(".", "");
return path;
}
}
Label1.Text = RandomUtil.GetRandomString();
Label2.Text = RandomString(10);
Label3.Text = RandomNumber(10,10000);
refer below link..
http://www.dotnetperls.com/random-string[
^]