/// <summary>Initializes an instance of the Orbit class with a specified parent and random number generator belonging to the orbiting body.</summary>
        /// <param name="parent">The body which the orbit circumscribes.</param>
        /// <param name="random">The seeded random number generator belonging to the orbiting body.</param>
        public Orbit(Body parent, StringSeededRandom random)
        {
            Parent = parent;
            double minA;

            if (parent.Children.Count == 0)
            {
                minA = Sqrt(G * parent.Mass / Pow(10, random.Uniform("first satellite gravity", -2, 0)));
            }
            else
            {
                minA = 1.5 * parent.Children[parent.Children.Count - 1].Orbit.SemiMajorAxis;
            }
            if (parent.HasRing)
            {
                if (parent.InnerRingRadius < minA && minA < parent.OuterRingRadius)
                {
                    minA = parent.OuterRingRadius;
                }
            }

            var maxA = 1.5 * minA;

            if (parent.HasRing)
            {
                if (parent.InnerRingRadius < maxA && maxA < parent.OuterRingRadius)
                {
                    maxA = parent.InnerRingRadius;
                }
            }

            if (maxA > parent.SphereOfInfluence)
            {
                maxA = parent.SphereOfInfluence;
            }
            Eccentricity        = Pow(random.Rand("eccentricity"), 10);
            SemiMajorAxis       = random.Uniform("semi-major axis", minA, maxA);
            Inclination         = PI / 2 * Pow(random.Rand("inclination"), 10);
            AscendingNode       = random.Uniform("ascending node", 0, 2 * PI);
            ArgumentOfPeriapsis = random.Uniform("argument of ascending node", 0, 2 * PI);
            MeanAnomaly         = random.Uniform("mean anomaly", 0, 2 * PI);
            Period    = OrbitalPeriod(SemiMajorAxis, parent.Mass);
            Periapsis = Periapsis(Eccentricity, SemiMajorAxis);
            Apoapsis  = Apoapsis(Eccentricity, SemiMajorAxis);
            Velocity  = OrbitalVelocity(SemiMajorAxis, Period);
        }
        /// <summary>Initializes a new instance of the Names class with a string to seed the random number generator.</summary>
        /// <param name="seedString">String to seed the random number generator.</param>
        public Names(string seedString)
        {
            Random = new StringSeededRandom(seedString + " names");
            var rgx  = new Regex("[^a-zA-Z]");
            var line = "";

            using (var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Universe.NameList.txt"))
            {
                if (resourceStream != null)
                {
                    using (var reader = new StreamReader(resourceStream))
                    {
                        line = reader.ReadToEnd();
                    }
                }
            }
            foreach (var word in line.Split(','))
            {
                WordList.Add("`" + rgx.Replace(word, "").ToLower() + "`");
            }
            var totals        = new double[27, 27];
            var initialsTotal = 0;

            foreach (var word in WordList)
            {
                Initials[word[1] - 96]++;
                initialsTotal++;
                for (var i = 0; i < word.Length - 2; i++)
                {
                    Probabilities[word[i] - 96, word[i + 1] - 96, word[i + 2] - 96]++;
                    totals[word[i] - 96, word[i + 1] - 96]++;
                }
            }

            for (var i = 0; i < 27; i++)
            {
                Initials[i] /= initialsTotal;
                for (var j = 0; j < 27; j++)
                {
                    for (var k = 0; k < 27; k++)
                    {
                        Probabilities[i, j, k] /= totals[i, j];
                    }
                }
            }
        }
 /// <summary>Initializes a new instance of the Body class with a specified name.</summary>
 /// <param name="star">The star which the body is closest to.</param>
 /// <param name="parent">The parent body which the body orbits around.</param>
 /// <param name="name">The name of the body, used to seed the random number generator.</param>
 protected Body(Body parent, Star star, string name = null)
 {
     Parent = parent;
     Star   = star;
     if (name == null)
     {
         name = new Names(Name).Name(new Random().NextDouble().ToString(CultureInfo.InvariantCulture));
     }
     Name = name.ToLower();
     if (this is Star)
     {
         System = Name;
     }
     else if (Star != null)
     {
         System = Star.Name;
     }
     Random = new StringSeededRandom(name);
 }