aboutsummaryrefslogtreecommitdiffstats
path: root/util/random/mersenne.h
blob: 464159c81d1c877c17787bc6549dc7544dc0fb13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
 
#include "mersenne64.h" 
#include "mersenne32.h" 
#include "common_ops.h" 
 
namespace NPrivate { 
    template <class T> 
    struct TMersenneTraits; 
 
    template <> 
    struct TMersenneTraits<ui64> { 
        using TImpl = TMersenne64;
    }; 
 
    template <> 
    struct TMersenneTraits<ui32> { 
        using TImpl = TMersenne32;
    }; 
} 
 
class IInputStream;
 
template <class T> 
class TMersenne: public TCommonRNG<T, TMersenne<T>>, public ::NPrivate::TMersenneTraits<T>::TImpl {
public: 
    using TBase = typename ::NPrivate::TMersenneTraits<T>::TImpl;
 
    inline TMersenne() noexcept {
    } 
 
    inline TMersenne(T seed) noexcept
        : TBase(seed) 
    { 
    } 
 
    inline TMersenne(IInputStream& pool)
        : TBase(pool) 
    { 
    } 
 
    inline TMersenne(const T* keys, size_t len) noexcept
        : TBase(keys, len) 
    { 
    } 
};