Skip to content

Commit

Permalink
binary_collision: use rng::Uniform
Browse files Browse the repository at this point in the history
could be further streamlined

This changes the behavior of RngC: it can now return 0 instead of 1.
However, it seems like this is actually the correct behavior.
  • Loading branch information
James committed Jun 7, 2023
1 parent b8c36f5 commit 085a04a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/include/binary_collision.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#pragma once

#include "cuda_compat.h"
#include "rng.hxx"

#include <cmath>

Expand All @@ -14,17 +15,9 @@ struct RngC
// ----------------------------------------------------------------------
// uniform
//
// returns random number in ]0:1]
// returns random number in [0:1[

real_t uniform()
{
real_t ran;
do {
ran = real_t(random()) / RAND_MAX;
} while (ran == real_t(0.f));

return ran;
}
real_t uniform() { return rng::Uniform<real_t>{}.get(); }
};

// ======================================================================
Expand Down

0 comments on commit 085a04a

Please sign in to comment.