Hello,
Take a look.
/// Verify the random string
public string RandomString
{
get
{
string str = "";
while (true)
{
str = InternalRandomString;
if (! m_lastRandomString.Contains(str))
{
m_lastRandomString.Add( str);
break;
}
}
return str;
}
}
/// <summary>
/// Generates a m_random string with the given length
/// </summary>
/// <returns>Random string</returns>
private string InternalRandomString
{
get
{
StringBuilder builder = new StringBuilder();
char ch;
int size = m_random.Next(2 , 8);
for (int i = 0 ; i < size ; i++)
{
ch = Convert.ToChar(m_random.Next(97 , 122));
builder.Append(ch);
}
return builder.ToString();
}
}
--
Sincerely
Yaron Karni
http://dotnetbible.blogspot.com/
"BillG" wrote:
Hi,
Does anyone know of a site or have code for a function that will generate a
random string or random number?
I need one where I can tell it what type of value I need and where I can set
the length of the desired output.
Thanks