Skip to content

Commit

Permalink
Use bernoully distribution to select samples
Browse files Browse the repository at this point in the history
  • Loading branch information
nahueespinosa committed Nov 11, 2022
1 parent 350210a commit a38afc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions beluga/core/include/beluga/algorithm/sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace beluga {

template <class Function1, class Function2, class RandomNumberGenerator>
auto random_select(Function1&& first, Function2&& second, RandomNumberGenerator& generator, double probability) {
return [&, probability, distribution = std::uniform_real_distribution{}]() mutable {
return distribution(generator) < probability ? first() : second();
return [&, distribution = std::bernoulli_distribution{probability}]() mutable {
return distribution(generator) ? first() : second();
};
}

Expand Down

0 comments on commit a38afc6

Please sign in to comment.