Skip to content

Commit

Permalink
in the for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebutts committed Jul 2, 2023
1 parent 0940ad8 commit ceed4ed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/dqrng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,13 @@ Rcpp::IntegerVector dqrrademacher(size_t n) {
for (size_t i = 0; i < ceil(n / 64.0) - 1; ++i) {
uint64_t bits = (*rng)();

for (int j = 0; j <= 63; ++j) {
for (int j = 0; j <= 63; ++j, ++k) {
res[k] = ((bits >> j) & 1) * 2 - 1;
k++;
}
}

uint64_t bits = (*rng)();
for (int j = 0; k < n; ++k, ++j) {
for (int j = 0; k < n; ++j, ++k) {
res[k] = ((bits >> j) & 1) * 2 - 1;
}

Expand Down

0 comments on commit ceed4ed

Please sign in to comment.