cds  2.3.2
cds::opt::v::random2_permutation< Int > Class Template Reference

Permutation generator of power-of-2 length based on rand() More...

#include <cds/opt/permutation.h>

Public Types

typedef Int integer_type
 Type of generated value.
 

Public Member Functions

 random2_permutation (size_t nLength)
 Initializes the generator of length nLength. More...
 
 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.
 

Detailed Description

template<typename Int = int>
class cds::opt::v::random2_permutation< Int >

Permutation generator of power-of-2 length based on rand()

The class is suitable for opt::permutation_generator option.

The generator calculates n = rand() and produces the sequence [n % nLen, (n + 1) % nLen, ..., (n + nLen - 1) % nLen]. The generator does not allocate any memory. nLen must be power of two.

Int template argument specifies the type of generated value, it should be any integer.

Constructor & Destructor Documentation

◆ random2_permutation()

template<typename Int = int>
cds::opt::v::random2_permutation< Int >::random2_permutation ( size_t  nLength)
inline

Initializes the generator of length nLength.

An assertion is raised if nLength is not a power of two.


The documentation for this class was generated from the following file:

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:52 by Doxygen 1.8.13