public static ISO639[] GetRandomTargets(Random random, Language[] languages, Language startLanguage, int layers)
        {
            var targets = new ISO639[layers + 1];

            var runningLanguageList = new List <Language>(languages);

            Language lastLanguage = startLanguage;

            while (lastLanguage == startLanguage)
            {
                lastLanguage = runningLanguageList[
                    random.Next(0, runningLanguageList.Count - 1)
                               ];
            }

            targets[0] = GetLanguageCode(lastLanguage);

            runningLanguageList.Remove(lastLanguage);

            for (int i = 1; i < layers - 1; i++)
            {
                var language = runningLanguageList[
                    random.Next(0, runningLanguageList.Count - 1)
                               ];
                runningLanguageList.Remove(language);
                runningLanguageList.Add(lastLanguage);
                lastLanguage = language;

                targets[i] = GetLanguageCode(language);
            }

            var finalLanguage = lastLanguage;

            while (finalLanguage == lastLanguage || finalLanguage == startLanguage)
            {
                finalLanguage = runningLanguageList[
                    random.Next(0, runningLanguageList.Count - 1)
                                ];
            }

            targets[layers - 1] = GetLanguageCode(finalLanguage);

            targets[layers] = GetLanguageCode(startLanguage);

            return(targets);
        }
 public Translation(string text, ISO639 iso639)
 {
     Text   = text;
     ISO639 = iso639;
 }