-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmysakLib.h
58 lines (43 loc) · 828 Bytes
/
mysakLib.h
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
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "types.h"
#if defined INTERACTIVE && !defined _WIN
# include <termios.h>
#endif
#ifndef M_LOGFILE_NAME
# define M_LOGFILE_NAME "mLib.log"
#endif
namespace MLib
{
class Log;
class MysakLib
{
friend class Log;
public:
static MysakLib INSTANCE;
unsigned loglevel;
private:
ulong_t randSeed;
ulong_t startTime;
#ifdef INTERACTIVE
# ifdef _WIN
DWORD oldDwMode;
# else
termios oldTerminos;
termios newTerminos;
# endif
#endif
std::ofstream logfile;
MysakLib();
~MysakLib();
public:
/* random uint */
ulong_t randUInt(ulong_t min, ulong_t max);
/* random int */
long randInt(long min, long max);
/* Probability in percent */
bool prob(ulong_t probability);
void makeRawConsole();
void makeNormalConsole();
};
} // namespace MLib
#define mLib ::MLib::MysakLib::INSTANCE