cds
2.3.2
|
Permutation generator based on std::shuffle
.
More...
#include <cds/opt/permutation.h>
Public Types | |
typedef Int | integer_type |
Type of generated value. | |
typedef RandomGenerator | random_generator |
random generator | |
typedef RandomDevice | random_device |
random device | |
Public Member Functions | |
random_shuffle_permutation (size_t nLength) | |
Initializes the generator of arbitrary length nLength . | |
operator integer_type () const | |
Returns the current value. | |
bool | next () |
Goes to next value. Returns false if the sequence is exhausted. | |
void | reset () |
Resets the generator to produce new sequence. | |
Permutation generator based on std::shuffle
.
The class is suitable for opt::permutation_generator
option.
The generator produces a permutation of [0, nLen)
sequence. The generator instance allocates a memory block.
Template parameters:
Int
- specifies the type of generated value, it should be any integer.RandomGenerator
- random generator, default is std::mt19937
RandomDevice
- random device, default is std::random_device