Random operations on sequence instances.
More...
Random operations on sequence instances.
These operations make random decisions.
◆ any()
| Inst::value_type tgen::any |
( |
const Inst & | inst | ) |
|
Choses a random element from the sequence instance.
- Template Parameters
-
- Parameters
-
| inst | the original instance. |
- Returns
- A uniformly random element from the instance.
Complexity
O(1).
Examples
std::cout <<
It::value_type any(It first, It last)
Choses a random element from iterator range.
Definition at line 382 of file tgen.h.
◆ choose()
| Inst tgen::choose |
( |
int | k, |
|
|
const Inst & | inst ) |
Chooses some values from the sequence instance, as in a subsequence of fixed length.
- Template Parameters
-
- Parameters
-
| k | The size of the subsequence. |
| inst | the original instance. |
- Returns
- A uniformly random subsequence of length k.
Complexity
O(|inst|).
Examples
std::cout <<
C choose(int k, const C &container)
Chooses elements from container, as in a subsequence fixed length.
Definition at line 415 of file tgen.h.
◆ shuffled()
| Inst tgen::shuffled |
( |
const Inst & | inst | ) |
|
Shuffles a sequence instance.
- Template Parameters
-
- Parameters
-
| inst | the original instance. |
- Returns
- The shuffled instance.
Complexity
O(|inst|).
Examples
std::cout <<
void shuffle(It first, It last)
Shuffles range inplace, for random_access_iterator.
Definition at line 351 of file tgen.h.