Go to the documentation of this file.
15 return (
static_cast<std::uint64_t
>(1) << NUM_BITS) - 1;
36 return const_cast<T&
>(mRng.base());
64 return std::unique_ptr<RNGWrapper>(
new RNGWrapper(mRng.base()));
71 return std::unique_ptr<RNGWrapper>(
new RNGWrapper(_seed));
75 template <
class Engine,
class Scalar,
class Quaternion>
77 Engine& _engine, std::uniform_real_distribution<Scalar>& _distribution)
79 assert(_distribution.a() == 0.);
80 assert(_distribution.b() == 1.);
82 const double u1 = _distribution(_engine);
83 const double u2 = _distribution(_engine);
84 const double u3 = _distribution(_engine);
87 std::sqrt(1. - u1) * std::sin(2. * M_PI * u2),
88 std::sqrt(1. - u1) * std::cos(2. * M_PI * u2),
89 std::sqrt(u1) * std::sin(2. * M_PI * u3),
90 std::sqrt(u1) * std::cos(2. * M_PI * u3));
std::unique_ptr< RNG > clone() const override
Create a copy of this RNG, including its internal state.
Definition: RNG-impl.hpp:62
RNGWrapper()=default
Constructs a random engine with a default seed.
static constexpr result_type max()
Gets the largest possible value in the output range, 2^NUM_BITS - 1.
Definition: RNG-impl.hpp:13
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
Concrete implementation of the RNG type erasure class.
Definition: RNG.hpp:72
static constexpr result_type min()
Gets the smallest possible value in the output range, always zero.
Definition: RNG-impl.hpp:7
result_type operator()() override
Advances the state of the engine and returns the generated value.
Definition: RNG-impl.hpp:48
void discard(unsigned long long _z) override
Advances the adaptor's state by a specified amount.
Definition: RNG-impl.hpp:55
T & rng()
Gets the internal random engine.
Definition: RNG-impl.hpp:32
Quaternion sampleQuaternion(Engine &_engine, std::uniform_real_distribution< Scalar > &_distribution)
Sample a unit quaternion uniformly at random.
Definition: RNG-impl.hpp:76
std::uint32_t result_type
Definition: RNG.hpp:27