Generating random strings



I am generating 12 random strings and my code works fine when I step
through, but when I then let it run without stepping through and
populate a listbox with the array I am building, I get the same value
repeated 12 times. Here is my code :

protected void btnGenerate_Click(object sender, EventArgs e)
{
string strDomainName = txtDomainName.Text.ToString();
string strEmailAddress = "";
string strEmailAddressComplete = "";

ArrayList arrEmailAddresses = new ArrayList();

for (int i = 0; i <= 12; i++)
{
//create 12 random email addresses for domain
EmailAddressGenerator emg = new EmailAddressGenerator();
strEmailAddress = emg.GenerateEmailAddress();
strEmailAddressComplete = strEmailAddress + "@" +
strDomainName;

//add email addresses to array
arrEmailAddresses.Add(strEmailAddressComplete);
}

foreach (string address in arrEmailAddresses)
{
lstEmailAddresses.Items.Add(address);
}
}





*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Demo: OO Cobol
    ... It inserts 50,000 random strings into a structure then does ... * Random string inserted into collections ... procedure division. ... perform Timer-on ...
    (comp.lang.cobol)
  • RE: Synchronize changes between a workbook and a "master file".
    ... Also see a sample of creating unique Id’s after the random strings. ... Random String Creation: ... Open a new workbook. ... Dim intMinLgth As Integer ...
    (microsoft.public.excel)
  • Re: FAQ: How can I generate good strong passwords?
    ... and take a string of 20 or more characters from the second line to use ... upper/lower case, numbers, special characters, ect. ... generating random strings, is it storing them -- it said it didn't and as ... had to put your finger exactly on the scanner as when your key was generated. ...
    (alt.internet.wireless)
  • Re: strcspn(3) complexity improvement
    ... >The real question I have is, how long does the string need to be before ... >this is a win and how much does it hurt for typical string lengths? ... >I've written code with strcspn that needed to perform well, ... deciding whether pairs of random strings are realistic. ...
    (freebsd-current)