|
tgen
|
Distinct generator for containers. More...
Public Member Functions | |
| template<typename C> | |
| distinct_container (const C &container) | |
| Creates distinct generator for elements of the given container. | |
| size_t | size () const |
| Returns the number of elements left to generate. | |
| T | gen () |
| Generates a distinct random element from the container. | |
| auto | gen_list (int size) |
| Generates a list of several distinct elements. | |
| auto | gen_all () |
| Generates all distinct elements left to generate. | |
Distinct generator for containers.
|
inline |
Creates distinct generator for elements of the given container.
| container | Container. |
The generator will generate distinct elements from container.
|
inline |
Generates a distinct random element from the container.
| std::runtime_error | if there no more elements to generate. |
O(log(n)) for the n-th call of gen.
|
inline |
Generates all distinct elements left to generate.
The same as calling distinct_container::gen until there are no more distinct values.
|
inline |
Generates a list of several distinct elements.
| std::runtime_error | if there are not enough elements to generate. |
The same as size calls to distinct_container::gen.
|
inline |
Returns the number of elements left to generate.
O(1).