Skip to content

Commit

Permalink
Cherry-pick fixes for latest dqrng release.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
plietar committed May 22, 2024
1 parent 397a7b7 commit 1c3283e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1c3283e

Please sign in to comment.