I have a class that name Cleint in that i have a function ,i want to make a three instantiate from Cleint with diffrent result of a Function but the results are same here is my code:
Programm.cs:
class Program
{
static void Main(string[] args)
{
Cleint B = new Cleint();
Cleint k = new Cleint();
Cleint S = new Cleint();
Console.WriteLine(B.GenerateAddress());
Console.WriteLine(k.GenerateAddress());
Console.WriteLine(S.GenerateAddress());
Console.ReadLine();
}
}
and Cleint.cs:
class Cleint
{
public string GenerateAddress()
{
var parts = new List<string>();
Random random = new Random();
for (int i = 0; i < 4; i++)
{
int newPart = random.Next(0, 255);
parts.Add(newPart.ToString());
}
string address = string.Join(".", parts);
p;
return address;
}
}
thank's for your help