private static BasicDistributionData GenerateBasicData(DistributionsEvaluator evaluator, Dictionary <string, DistributionSettings> univariateDistributions, Dictionary <string[], MultivariateDistributionSettings> multivariateDistributions, int samples, int pockets) { if (evaluator == null) { throw new ArgumentNullException(nameof(evaluator)); } if (univariateDistributions == null) { throw new ArgumentNullException(nameof(univariateDistributions)); } if (samples < 3) { throw new DistributionsArgumentException(DistributionsArgumentExceptionType.NumberOfExperimentsMustBeGreaterThenTwo); } if (pockets < 3) { throw new DistributionsArgumentException(DistributionsArgumentExceptionType.NumberOfPocketsMustBeGreaterThenTwo); } BasicDistributionData data = new BasicDistributionData(); double[] random; if (multivariateDistributions == null) { random = GenerateRandom(evaluator, univariateDistributions, samples); } else { random = GenerateRandom(evaluator, univariateDistributions, multivariateDistributions, samples); } Array.Sort(random); double[] xAxis = CommonRandomMath.GenerateXAxis(random[0], random[samples - 1], pockets, out _); double[] cdf = GenerateCDF(xAxis, random); data.RandomSorted = random; data.XAxis = xAxis; data.CDF = cdf; data.PDF = Derivate(cdf, xAxis[pockets - 1] - xAxis[0]); return(data); }
private MonteCarloDistribution(BasicDistributionData basicData) : base(basicData.XAxis, basicData.PDF, basicData.CDF) { randomSorted = basicData.RandomSorted; }