Go to the documentation of this file. 1 #ifndef AIKIDO_COMMON_RNG_HPP_
2 #define AIKIDO_COMMON_RNG_HPP_
10 #include <Eigen/Geometry>
34 virtual ~RNG() =
default;
54 virtual void discard(
unsigned long long _z) = 0;
59 virtual std::unique_ptr<RNG>
clone()
const = 0;
77 = std::independent_bits_engine<T, RNG::NUM_BITS, result_type>;
102 const T&
rng()
const;
108 void discard(
unsigned long long _z)
override;
111 std::unique_ptr<RNG>
clone()
const override;
132 class Quaternion = Eigen::Quaternion<Scalar>>
134 Engine& _engine, std::uniform_real_distribution<Scalar>& _distribution);
147 std::size_t _numOutputs,
166 #endif // AIKIDO_COMMON_RNG_HPP_
std::unique_ptr< RNG > clone() const override
Create a copy of this RNG, including its internal state.
Definition: RNG-impl.hpp:62
constexpr int NUM_DEFAULT_SEEDS
Default number of seeds to by cloneRNGsFrom to seed new engines.
Definition: RNG.hpp:20
std::vector< std::unique_ptr< common::RNG > > cloneRNGsFrom(RNG &_engine, std::size_t _numOutputs, std::size_t _numSeeds=NUM_DEFAULT_SEEDS)
Deterministically create different _numOutputs random number generators of the same type as the input...
virtual result_type operator()()=0
Advances the state of the engine and returns the generated value.
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
std::independent_bits_engine< T, RNG::NUM_BITS, result_type > engine_type
Definition: RNG.hpp:77
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
static constexpr std::size_t NUM_BITS
Number of bits the generated numbers should have.
Definition: RNG.hpp:32
void discard(unsigned long long _z) override
Advances the adaptor's state by a specified amount.
Definition: RNG-impl.hpp:55
virtual void discard(unsigned long long _z)=0
Advances the adaptor's state by a specified amount.
T & rng()
Gets the internal random engine.
Definition: RNG-impl.hpp:32
Implementation of the C++11 "random engine" concept that uses virtual function calls to erase the typ...
Definition: RNG.hpp:24
std::vector< std::unique_ptr< common::RNG > > cloneRNGFrom(RNG &_engine, std::size_t _numSeeds=NUM_DEFAULT_SEEDS)
Deterministically create a random number generator of the same type as the input _engine.
virtual std::unique_ptr< RNG > clone() const =0
Create a copy of this RNG, including its internal state.
Quaternion sampleQuaternion(Engine &_engine, std::uniform_real_distribution< Scalar > &_distribution)
Sample a unit quaternion uniformly at random.
Definition: RNG-impl.hpp:76
engine_type mRng
Definition: RNG.hpp:117
virtual ~RNGWrapper()=default
#define AIKIDO_DECLARE_POINTERS(X)
Definition: pointers.hpp:21
std::uint32_t result_type
Definition: RNG.hpp:27