Sample SNPs
Fast ordered sampling of rows from large text or binary files. Special cases for DNA variant files (.bed, VCF, HapMap, etc).
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
sampFiles::GenerateMT Class Reference

Pseudo-random number generator. More...

#include <random.hpp>

Inheritance diagram for sampFiles::GenerateMT:
[legend]
Collaboration diagram for sampFiles::GenerateMT:
[legend]

Public Member Functions

 GenerateMT ()
 Default constructor. More...
 
 ~GenerateMT ()
 Protected destructor.
 
 GenerateMT (const GenerateMT &old)=default
 Copy constructor. More...
 
 GenerateMT (GenerateMT &&old)=default
 Move constructor. More...
 
GenerateMToperator= (const GenerateMT &old)=default
 Copy assignment operator. More...
 
GenerateMToperator= (GenerateMT &&old)=default
 Move assignment. More...
 
volatile uint64_t ranInt ()
 Generate a pseudo-random 64-bit unsigned integer. More...
 
- Public Member Functions inherited from sampFiles::Generate
virtual ~Generate ()
 Protected destructor.
 

Protected Attributes

uint64_t _mt [312]
 Generator state array.
 
size_t _mti
 State of the array index.
 
uint64_t _x
 Current state.
 

Static Protected Attributes

static const unsigned short _n = 312
 Degree of recurrence.
 
static const unsigned short _m = 156
 Middle word.
 
static const uint64_t _um = static_cast<uint64_t>(0x7FFFFFFF)
 Most significant 33 bits.
 
static const uint64_t _lm = static_cast<uint64_t>(0xFFFFFFFF80000000)
 Least significant 31 bits.
 
static const uint64_t _b = static_cast<uint64_t>(0x71D67FFFEDA60000)
 Tempering bitmask.
 
static const uint64_t _c = static_cast<uint64_t>(0xFFF7EEE000000000)
 Tempering bitmask.
 
static const uint64_t _d = static_cast<uint64_t>(0x5555555555555555)
 Tempering bitmask.
 
static const unsigned int _l = 43
 Tempering shift.
 
static const unsigned int _s = 17
 Tempering shift.
 
static const unsigned int _t = 37
 Tempering shift.
 
static const unsigned int _u = 29
 Tempering shift.
 
static const uint64_t _alt [2] = {static_cast<uint64_t>(0), static_cast<uint64_t>(0xB5026F5AA96619E9)}
 Array of alternative values for the twist.
 

Additional Inherited Members

- Protected Member Functions inherited from sampFiles::Generate
 Generate ()
 Protected default constructor.
 
 Generate (const Generate &old)
 Protected copy constructor. More...
 
 Generate (Generate &&old)
 Protected move constructor. More...
 
Generateoperator= (const Generate &old)=default
 Protected copy assignment operator. More...
 
Generateoperator= (Generate &&old)=default
 Protected move assignment. More...
 

Detailed Description

Pseudo-random number generator.

An implementaiton of the 64-bit MT19937 ("Mersenne Twister") [1] pseudo-random number generator (PRNG). The constructor automatically seeds the PRNG. The implementation was guided by the reference code posted by the authors.

Constructor & Destructor Documentation

◆ GenerateMT() [1/3]

GenerateMT::GenerateMT ( )

Default constructor.

Seeds the PRNG with a call to the RDTSC instruction.

◆ GenerateMT() [2/3]

sampFiles::GenerateMT::GenerateMT ( const GenerateMT old)
default

Copy constructor.

Parameters
[in]oldobject to copy

◆ GenerateMT() [3/3]

sampFiles::GenerateMT::GenerateMT ( GenerateMT &&  old)
default

Move constructor.

Parameters
[in]oldobject to move

Member Function Documentation

◆ operator=() [1/2]

GenerateMT& sampFiles::GenerateMT::operator= ( const GenerateMT old)
default

Copy assignment operator.

Parameters
[in]oldobject to copy

◆ operator=() [2/2]

GenerateMT& sampFiles::GenerateMT::operator= ( GenerateMT &&  old)
default

Move assignment.

Parameters
[in]oldobject to move

◆ ranInt()

volatile uint64_t GenerateMT::ranInt ( )
virtual

Generate a pseudo-random 64-bit unsigned integer.

Returns
pseudo-random 64-bit unsigned integer

Implements sampFiles::Generate.


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