Skip to content

Commit

Permalink
Merge pull request #311 from mrc-ide/fix-dqrng
Browse files Browse the repository at this point in the history
Cherry-pick fixes for latest dqrng release.
  • Loading branch information
plietar authored May 23, 2024
2 parents 397a7b7 + 1c3283e commit fdd7c68
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 fdd7c68

Please sign in to comment.