public static string GetRandomName(IList<string> primaryCollection, IList<string> secondaryCollection, IList<string> tertiaryCollection, ref int attempt, out string baseName)
{
string retVal = "";
attempt++;
baseName = "";
if ((secondaryCollection == null && tertiaryCollection == null) || attempt < 5)
{
baseName = GetSampleValueRandom(primaryCollection);
retVal = baseName;
}
else if (tertiaryCollection == null)
{
baseName = GetSampleValueRandom(primaryCollection);
retVal = string.Format("{0} {1}", baseName, GetSampleValueRandom(secondaryCollection));
}
else
{
if (attempt < 10)
{
baseName = GetSampleValueRandom(primaryCollection);
retVal = string.Format("{0} {1}", baseName, GetSampleValueRandom(secondaryCollection));
}
else if (attempt < 20)
{
baseName = GetSampleValueRandom(primaryCollection);
retVal = string.Format("{0} {1}", baseName, GetSampleValueRandom(tertiaryCollection));
}
else
{
baseName = GetSampleValueRandom(primaryCollection);
retVal = string.Format("{0} {1} {2}", baseName, GetSampleValueRandom(secondaryCollection), GetSampleValueRandom(tertiaryCollection));
}
}
if (attempt > 40)
{
retVal += string.Format("{0} {1}", retVal, _randomGen.Next(10000).ToString());
}
return retVal;
}