// Use this for initialization void Start() { ProbMeter p = new ProbMeter(new double[] { 0, 2, 4, 8 }, new double[] { 2, 1, 1 }); Debug.Log(p.getValue(.25)); Debug.Log(p.getValue(.5)); Debug.Log(p.getValue(1)); int[] count = { 0, 0, 0, 0 }; for (int i = 0; i < 100000000; i++) { float num = PlanetBuilder.eDist(.5, 10000, Random.value); if (num < 10) { count[0]++; } else if (num < 100) { count[1]++; } else if (num < 1000) { count[2]++; } else if (num < 10000) { count[3]++; } } print(count[0] + " " + count[1] + " " + count[2] + " " + count[3]); }
public void generateStuff() { System.Random rand = new System.Random(Random.Range(int.MinValue, int.MaxValue)); for (int i = 0; i < 10; i++) { Planet planet = new Planet(PlanetBuilder.eDist(100000, 1000000, rand.NextDouble()), new LongPos(rand.Next(-30000, 30000) * 10000L, rand.Next(-20, 20) * 10000L, rand.Next(-30000, 30000) * 10000L), rand.Next(int.MinValue, int.MaxValue)); planets.Add(planet); } star = new Star(3452, 23000000, new LongPos(0, 0, 0)); }