Files
dotNetStudyWithGPT/MySolution/SObject/Zoo.cs
2023-10-13 14:15:26 +09:00

39 lines
856 B
C#

namespace SObject
{
public class Zoo
{
private Random _rand;
public List<DogFamily> Dogs { get; set; }
public Zoo()
{
_rand = new Random();
this.Dogs = new List<DogFamily>()
{
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
GetDog(),
};
}
public DogFamily GetDog()
{
DogFamily dog;
int seed = _rand.Next(0, 20);
if (seed % 2 == 0)
dog = new Wolf($"W{seed % 7}", seed);
else
dog = new Coyote($"C{seed % 7}", seed);
return dog;
}
}
}