forked from tangjianpku/LINE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandnum.h
More file actions
executable file
·30 lines (30 loc) · 924 Bytes
/
randnum.h
File metadata and controls
executable file
·30 lines (30 loc) · 924 Bytes
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
#pragma once
#ifndef RANDNUM_H
#define RANDNUM_H
#ifndef INCLUDE_IOSTREAM
#define INCLUDE_IOSTREAM
#include <iostream>
#endif
#ifndef INCLUDE_CTIME
#define INCLUDE_CTIME
#include <ctime>
#endif
#ifndef INCLUDE_CMATH
#define INCLUDE_CMATH
#include <cmath>
#endif
#ifndef INCLUDE_CSTDLIB
#define CSTDLIB
#include <cstdlib>
#endif
class RandNum
{
public:
RandNum(time_t* init=NULL);
int Rand(int N); // 基本的随机数生成函数0~N-1
~RandNum();
long randLong(long upBound); //大的随机数生产函数,均匀0~upBound-1,当使用long long 类型时可生成范围会更大(只要该一下类型就好)
private:
long randTemp(int exp);//随机数生成函数0~10^exp-1,这是作为private 成员,是生成其他大随机数的基础
};
#endif /*RANDNUM_H*/