#include <rsl/export.hpp>
#include <Eigen/Geometry>
#include <cassert>
#include <random>
#include <type_traits>
Go to the source code of this file.
|
RSL_EXPORT auto | rsl::rng (std::seed_seq seed_sequence={}) -> std::mt19937 & |
| Get a random number generator.
|
|
template<typename RealType > |
auto | rsl::uniform_real (RealType lower, RealType upper) |
| Get a uniform real number in a given range.
|
|
template<typename IntType > |
auto | rsl::uniform_int (IntType lower, IntType upper) |
| Get a uniform integer number in a given range.
|
|
RSL_EXPORT auto | rsl::random_unit_quaternion () -> Eigen::Quaterniond |
| Generate a random unit quaternion of doubles.
|
|
◆ random_unit_quaternion()
RSL_EXPORT auto rsl::random_unit_quaternion |
( |
| ) |
-> Eigen::Quaterniond |
Generate a random unit quaternion of doubles.
- Returns
- Random unit quaternion
◆ rng()
RSL_EXPORT auto rsl::rng |
( |
std::seed_seq |
seed_sequence = {} | ) |
-> std::mt19937 & |
Get a random number generator.
The first time this function is called it creates a thread_local random number generator. If a seed sequence is provided on that first call it is used to create the generator, otherwise the random device is used to seed the generator. After the first call to this function, if a seed sequence is provided this function throws. The returned value is a reference to a thread_local static generator.
- Parameters
-
seed_sequence | Seed sequence for random number generator |
- Returns
- Seeded random number generator
◆ uniform_int()
template<typename IntType >
auto rsl::uniform_int |
( |
IntType |
lower, |
|
|
IntType |
upper |
|
) |
| |
Get a uniform integer number in a given range.
- Parameters
-
lower | Lower bound, inclusive |
upper | Upper bound, inclusive |
- Template Parameters
-
- Returns
- Uniform integer in range [lower, upper]
◆ uniform_real()
template<typename RealType >
auto rsl::uniform_real |
( |
RealType |
lower, |
|
|
RealType |
upper |
|
) |
| |
Get a uniform real number in a given range.
- Parameters
-
lower | Lower bound, inclusive |
upper | Upper bound, exclusive |
- Template Parameters
-
RealType | Floating point type |
- Returns
- Uniform real in range [lower, upper)