当前位置: 首页>>代码示例>>Java>>正文


Java MersenneTwister.DEFAULT_SEED属性代码示例

本文整理汇总了Java中cern.jet.random.engine.MersenneTwister.DEFAULT_SEED属性的典型用法代码示例。如果您正苦于以下问题:Java MersenneTwister.DEFAULT_SEED属性的具体用法?Java MersenneTwister.DEFAULT_SEED怎么用?Java MersenneTwister.DEFAULT_SEED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cern.jet.random.engine.MersenneTwister的用法示例。


在下文中一共展示了MersenneTwister.DEFAULT_SEED属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFlat

@Test
//TODO if this interpolator cannot get the answer right then an exception should be thrown
public void testFlat() {
  final RandomEngine random = new MersenneTwister64(MersenneTwister.DEFAULT_SEED);
  final double x1 = 10 * random.nextDouble();
  final double x2 = 10 * random.nextDouble();
  final double x3 = 10 * random.nextDouble();
  // Fails utterly for flat surface since the variogram function will be zero for all r
  final InterpolatorND interpolator = new KrigingInterpolatorND(1.99);
  final InterpolatorNDDataBundle dataBundle = interpolator.getDataBundle(FLAT_DATA);
  assertEquals(INTERPOLATOR.interpolate(dataBundle, new double[] {x1, x2, x3}), 0, 0);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:KrigingInterpolatorNDTest.java

示例2: test

@Test
public void test() {
  final double mu = 0.367;
  final double b = 1.4;
  final ProbabilityDistribution<Double> distribution = new LaplaceDistribution(mu, b, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
  final int n = 500000;
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = distribution.nextRandom();
  }
  final LaplaceDistribution result = (LaplaceDistribution) ESTIMATOR.evaluate(x);
  final double eps = 1e-2;
  assertEquals(1, result.getB() / b, eps);
  assertEquals(1, result.getMu() / mu, eps);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:LaplaceDistributionMaximumLikelihoodEstimatorTest.java

示例3: test

@Test
public void test() {
  final int n = 500000;
  final double k = 1.34;
  final ProbabilityDistribution<Double> p1 = new ChiSquareDistribution(k, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = p1.nextRandom();
  }
  final ChiSquareDistribution p2 = (ChiSquareDistribution) CALCULATOR.evaluate(x);
  assertEquals(p2.getDegreesOfFreedom(), k, 2.5e-2);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:12,代码来源:ChiSquareDistributionMomentEstimatorTest.java

示例4: test

@Test
public void test() {
  final int n = 500000;
  final double k = 0.97;
  final double theta = 0.46;
  final ProbabilityDistribution<Double> p1 = new GammaDistribution(k, theta, new MersenneTwister(MersenneTwister.DEFAULT_SEED));
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = p1.nextRandom();
  }
  final GammaDistribution p2 = (GammaDistribution) CALCULATOR.evaluate(x);
  final double eps = 0.025;
  assertEquals(p2.getK(), k, eps);
  assertEquals(p2.getTheta(), theta, eps);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:GammaDistributionMomentEstimatorTest.java

示例5: test

@Test
public void test() {
  final int n = 500000;
  final double mu = 4.5;
  final double sigma = 0.86;
  final ProbabilityDistribution<Double> p1 = new NormalDistribution(mu, sigma, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = p1.nextRandom();
  }
  final NormalDistribution p2 = (NormalDistribution) CALCULATOR.evaluate(x);
  assertEquals(p2.getMean(), mu, 2.5e-2);
  assertEquals(p2.getStandardDeviation(), sigma, 2.5e-2);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:14,代码来源:NormalDistributionMomentEstimatorTest.java

示例6: test

@Test(groups = TestGroup.UNIT_SLOW)
public void test() {
  final int n = 500000;
  final double eps = 5e-2;
  final double nu = 5.4;
  final ProbabilityDistribution<Double> p1 = new StudentTDistribution(nu, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = p1.nextRandom();
  }
  final StudentTDistribution p2 = (StudentTDistribution) ESTIMATOR.evaluate(x);
  assertEquals(p2.getDegreesOfFreedom(), nu, eps);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:StudentTDistributionMaximumLikelihoodEstimatorTest.java

示例7: test

@Test
public void test() {
  final int n = 500000;
  final double eps = 1e-2;
  final double mu = -1.3;
  final double sigma = 0.4;
  final ProbabilityDistribution<Double> p1 = new NormalDistribution(mu, sigma, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
  final double[] x = new double[n];
  for (int i = 0; i < n; i++) {
    x[i] = p1.nextRandom();
  }
  final NormalDistribution p2 = (NormalDistribution) ESTIMATOR.evaluate(x);
  assertEquals(p2.getMean(), mu, eps);
  assertEquals(p2.getStandardDeviation(), sigma, eps);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:NormalDistributionMaximumLikelihoodEstimatorTest.java

示例8: SmileInterpolator

public SmileInterpolator(final VolatilityFunctionProvider<T> model) {
  this(MersenneTwister.DEFAULT_SEED, model);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:3,代码来源:SmileInterpolator.java

示例9: MarkovChain

public MarkovChain(final double vol1, final double vol2, final double lambda12, final double lambda21, final double probState1) {
  this(vol1, vol2, lambda12, lambda21, probState1, MersenneTwister.DEFAULT_SEED);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:3,代码来源:MarkovChain.java


注:本文中的cern.jet.random.engine.MersenneTwister.DEFAULT_SEED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。