// 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 RockPrint(Sub sub, ProbMeter sp, bool sd, ProbMeter ap, ProbMeter dp) { substance = sub; sizeprob = sp; subDependent = sd; amountProb = ap; dispProb = dp; }
/////static method that generates blueprints// //TODO: implement static probmeters that generate the probmeters public static RockPrint buildBlueprint(int seed, Sub sub) { System.Random rand = new System.Random(seed); //create the size probmeter(will be more complex later) double smallSize = rand.NextDouble() * 4; ProbMeter sizeprob = new ProbMeter(new double[] { smallSize, smallSize + rand.NextDouble() * 4 }, new double[] { 1 }); //randomly choose if these rocks will be dependent on the substance(most likely) bool subDep = rand.NextDouble() < .5; //create the amount probmeter double smallAm = rand.NextDouble() * 4; ProbMeter amount = new ProbMeter(new double[] { smallAm, smallAm + rand.NextDouble() * 4 }, new double[] { 1 }); double smallDisp = rand.NextDouble(); //*.5f; ProbMeter disp = new ProbMeter(new double[] { smallDisp, smallDisp }, new double[] { 1 }); RockPrint rp = new RockPrint(sub, sizeprob, subDep, amount, disp); return(rp); }