|
tgen
|
Unique generator for discrete uniform functions. More...
Public Member Functions | |
| unique (Func func, Args... args) | |
| Generates a unique generator of a discrete uniform function. | |
| auto | gen () |
| Generates a unique value. | |
| auto | gen_list (int size) |
| Generates a list of several unique values. | |
| bool | empty () |
| Checks if there is nothing left to generate. | |
| auto | gen_all () |
| Generates all unique values left to generate. | |
Unique generator for discrete uniform functions.
|
inline |
Generates a unique generator of a discrete uniform function.
| Func | Automatically set to the function type. |
| func | The function. |
| args | Arguments for the function. |
|
inline |
Checks if there is nothing left to generate.
The same as a call to unique::gen.
|
inline |
Generates a unique value.
| Func | Automatically set to the function type. |
| std::runtime_error | if there are probably (with probability at least 1 - 10^(-18)) no more unique instances to generate. |
O(T * log k + log^2 k) amortized expected, if the function runs in O(T) time and k unique values have been generated.
Reference:
|
inline |
Generates all unique values left to generate.
The same as calling unique::gen until there are no more unique values.
|
inline |
Generates a list of several unique values.
| size | Size of the list to be generated. |
| std::runtime_error | if there are not enough values to generate. |
The same as size calls to unique::gen.