aboutsummaryrefslogtreecommitdiffstats
path: root/util/random/easy.h
blob: 72e1db7a6bbfa6c71a577c51f4e230d1b2acbbee (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
47
#pragma once

#include "random.h"

namespace NPrivate {
    struct TRandom {
        inline operator unsigned char() {
            return RandomNumber<unsigned char>();
        }

        inline operator unsigned short() {
            return RandomNumber<unsigned short>();
        }

        inline operator unsigned int() {
            return RandomNumber<unsigned int>();
        }

        inline operator unsigned long() {
            return RandomNumber<unsigned long>();
        }

        inline operator unsigned long long() {
            return RandomNumber<unsigned long long>();
        }

        inline operator bool() {
            return RandomNumber<bool>();
        }

        inline operator float() {
            return RandomNumber<float>();
        }

        inline operator double() {
            return RandomNumber<double>();
        }

        inline operator long double() {
            return RandomNumber<long double>();
        }
    };
} // namespace NPrivate

static inline ::NPrivate::TRandom Random() noexcept {
    return {};
}