Class for random algorithms.
More...
#include <Random.h>
|
| | Random (unsigned long seed=std::random_device()()) |
| | Constructor.
|
| |
| | Random (const Random &other)=delete |
| | Class should not be copied constructed.
|
| |
| Random & | operator= (const Random &other)=delete |
| | Class should not be copied assigned.
|
| |
| template<class Iter > |
| std::vector< typename std::iterator_traits< Iter >::value_type > | uniformSample (Iter poolBegin, Iter poolEnd, size_t n) |
| | Sample n points from the pool.
|
| |
| std::vector< size_t > | uniformSample (size_t min, size_t max, size_t n) |
| | Sample n points from the set {min;min+1;...;max}.
|
| |
| template<class Container > |
| auto | pickRandom (const Container &pool) |
| | Get a uniformly randomly selected object from the given container.
|
| |
| template<class T > |
| std::set< T > | randomSubset (std::set< T > pool, size_t n) |
| | Pick up to n random elements from the set.
|
| |
Class for random algorithms.
◆ Random() [1/2]
| autopas::Random::Random |
( |
unsigned long |
seed = std::random_device()() | ) |
|
|
inlineexplicit |
◆ Random() [2/2]
| autopas::Random::Random |
( |
const Random & |
other | ) |
|
|
delete |
Class should not be copied constructed.
- Parameters
-
◆ operator=()
Class should not be copied assigned.
- Parameters
-
- Returns
◆ pickRandom()
template<class Container >
| auto autopas::Random::pickRandom |
( |
const Container & |
pool | ) |
|
|
inline |
Get a uniformly randomly selected object from the given container.
- Template Parameters
-
| Container | Type of the container. Must support std::begin(). |
| Elem | Type of the elements in the container. |
- Parameters
-
| pool | Container from which to select an element. |
- Returns
- Randomly selected element.
◆ randomSubset()
template<class T >
| std::set< T > autopas::Random::randomSubset |
( |
std::set< T > |
pool, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Pick up to n random elements from the set.
Each elements has the same probability to be chosen
- Parameters
-
| pool | set |
| n | number of elements |
- Returns
- n random elements
◆ uniformSample() [1/2]
template<class Iter >
| std::vector< typename std::iterator_traits< Iter >::value_type > autopas::Random::uniformSample |
( |
Iter |
poolBegin, |
|
|
Iter |
poolEnd, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Sample n points from the pool.
Each element in the pool will appear about the same number of times in the sample.
- Template Parameters
-
- Parameters
-
| poolBegin | |
| poolEnd | |
| n | number samples |
- Returns
- samples
◆ uniformSample() [2/2]
| std::vector< size_t > autopas::Random::uniformSample |
( |
size_t |
min, |
|
|
size_t |
max, |
|
|
size_t |
n |
|
) |
| |
|
inline |
Sample n points from the set {min;min+1;...;max}.
Each element in the set will appear about the same number of times in the sample.
- Parameters
-
- Returns
- samples
The documentation for this class was generated from the following file: