From 13e0ba5aff3fe14eb0e1d748cad4b9f99e681ca0 Mon Sep 17 00:00:00 2001 From: Gilles Date: Wed, 16 Aug 2017 15:20:58 +0200 Subject: [PATCH] Explicitly use class from "Commons RNG". Change removes the dependency loop between "o.a.c.math4.random" and "o.a.c.math4.distribution" packages. --- .../commons/math4/random/GaussianRandomGenerator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java index fc7f98cc2..5c108c0f5 100644 --- a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java +++ b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java @@ -18,8 +18,8 @@ package org.apache.commons.math4.random; import org.apache.commons.rng.UniformRandomProvider; -import org.apache.commons.math4.distribution.RealDistribution; -import org.apache.commons.math4.distribution.NormalDistribution; +import org.apache.commons.rng.sampling.distribution.NormalizedGaussianSampler; +import org.apache.commons.rng.sampling.distribution.MarsagliaNormalizedGaussianSampler; /** * Random generator that generates normally distributed samples. @@ -28,7 +28,7 @@ import org.apache.commons.math4.distribution.NormalDistribution; */ public class GaussianRandomGenerator implements NormalizedRandomGenerator { /** Gaussian distribution sampler. */ - private final RealDistribution.Sampler sampler; + private final NormalizedGaussianSampler sampler; /** * Creates a new generator. @@ -36,7 +36,7 @@ public class GaussianRandomGenerator implements NormalizedRandomGenerator { * @param generator Underlying random generator. */ public GaussianRandomGenerator(final UniformRandomProvider generator) { - sampler = new NormalDistribution().createSampler(generator); + sampler = new MarsagliaNormalizedGaussianSampler(generator); } /**