From d8c648d7be1e77c5b1c41a426ee5c633cdcd575c Mon Sep 17 00:00:00 2001 From: Alex Herbert Date: Mon, 1 Jul 2024 17:26:08 +0100 Subject: [PATCH] Sonar fix: Rename variable to not match restricted identifier --- .../rng/sampling/distribution/DirichletSamplerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DirichletSamplerTest.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DirichletSamplerTest.java index b79dba1a..1dc6c6c0 100644 --- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DirichletSamplerTest.java +++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/DirichletSamplerTest.java @@ -228,8 +228,8 @@ private static void assertSamples(double... alpha) { final double[][] covars = getCovariance(samples); final double denom = alpha0 * alpha0 * (alpha0 + 1); for (int i = 0; i < k; i++) { - final double var = alpha[i] * (alpha0 - alpha[i]) / denom; - Assertions.assertEquals(var, covars[i][i], var * relativeTolerance, "Variance"); + final double variance = alpha[i] * (alpha0 - alpha[i]) / denom; + Assertions.assertEquals(variance, covars[i][i], variance * relativeTolerance, "Variance"); for (int j = i + 1; j < k; j++) { final double covar = -alpha[i] * alpha[j] / denom; Assertions.assertEquals(covar, covars[i][j], Math.abs(covar) * relativeTolerance, "Covariance");