From 1c3283e6a1a26f14f66148af8e5f44c3446eaf31 Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Wed, 22 May 2024 15:14:50 +0100 Subject: [PATCH] Cherry-pick fixes for latest dqrng release. The recent dqrng 0.4.0 release has a few small incompatible changes that makes the build fail. The changes necessary have been applied to the dev branch already as part of larger pull requests #280 and #305. This commit cherry-picks just the fixes for the master branch. --- src/Random.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Random.cpp b/src/Random.cpp index fad22963..1e4896f7 100644 --- a/src/Random.cpp +++ b/src/Random.cpp @@ -60,8 +60,8 @@ void Random::prop_sample_bucket( // all probabilities are the same if (heavy == n) { - for (auto i = 0; i < size; ++i) { - *result = (*rng)(n); + for (size_t i = 0; i < size; ++i) { + *result = (*rng)((uint64_t)n); ++result; } return; @@ -121,9 +121,9 @@ void Random::prop_sample_bucket( } // sample - for (auto i = 0; i < size; ++i) { - size_t bucket = (*rng)(n); - double acceptance = dqrng::uniform01((*rng)()); + for (size_t i = 0; i < size; ++i) { + size_t bucket = (*rng)((uint64_t)n); + double acceptance = rng->uniform01(); *result = (acceptance < dividing_probs[bucket]) ? bucket : alternative_index[bucket]; ++result;