I'm developing a program that generates up to 2 valid IMEI codes at a time for mobile phone testing. Although there is a method for each of the 2 codes, the program is always returning the same value for both (e.g. IMEI 1 = IMEI 2). Here's a sample of both methods (only the relevant parts).
IMEI 1:
public String IMEICode()
{
int[] code = new int[14];
Random generate = new Random();
int format = FormatCombo.SelectedIndex;
StringBuilder IMEI = new StringBuilder();
... //irrelevant
for (int i = 0; i < code.Length; i++)
{
code[i] = generate.Next(10);
}
... //irrelevant
return IMEI.ToString();
}
IMEI 2:
public String IMEICode2()
{
int[] code2 = new int[14];
Random generate2 = new Random();
int format = FormatCombo.SelectedIndex;
StringBuilder IMEI2 = new StringBuilder();
... //irrelevant
for (int i = 0; i < code2.Length; i++)
{
code2[i] = generate2.Next(10);
}
... //irrelevant
return IMEI2.ToString();
}
The program has 2 text boxes to display the generated codes (Field1 and Field2), each assigned to a method (IMEICode() and IMEICode2()).
PS.: I made sure that the first text box displays the IMEICode() method and the latter displays the IMEICode2() method.