math.cpp
来自「巫魔问题求解」· C++ 代码 · 共 34 行
CPP
34 行
#include "Math.h"
#include <cmath>
#include <ctime>
#include <cstdlib>
////////////////////////////////////////////
static class RandInit
{
public:
RandInit(void)
{
time_t t;
time(&t);
srand((unsigned int)t);
}
} afxRandInit;
////////////////////////////////////////////
int _tool::RandInt(void)
{
return rand();
}
////////////////////////////////////////////
int _tool::RandInt(unsigned int max)
{
return rand() % max;
}
////////////////////////////////////////////
double _tool::RandDouble(double max)
{
return max * rand() / RAND_MAX;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?