public string GetRandomWord(LongRandom rand, string subtype, string className, WordFormat format)
{
int subIndex = LookForSubtype(subtype);
if (subIndex == -1)
{
return Error("SubtypeNotFound->"+subtype);
}
int index = PickByWeight(className, rand);
if (className == "")
{
if (subIndex > Words[index].Length - 1)
{
return Error("SubtypeOutOfRange");
}
return Format(Words[index][subIndex], format);
}
else
{
if (!this.Classes.ContainsKey(className))
{
return Error("ClassNotFound->"+className);
}
return Format(Words[this.Classes[className][index]][subIndex], format);
}
}