NetCpp/include/utils/random_generator.h
2020-07-07 03:28:29 +08:00

31 lines
554 B
C++

//
// Created by 胡宇 on 2020/7/7.
//
#ifndef NET_RANDOM_GENERATOR_H
#define NET_RANDOM_GENERATOR_H
#include <boost/random.hpp>
#include <boost/random/random_device.hpp>
namespace Net{
namespace Rand{
// 范围均匀分布无符号32位整数
class UniformUInt {
public:
UniformUInt(uint32_t min, uint32_t max) : uniformInt(min, max){
}
int generate() const;
private:
boost::uniform_int<uint32_t> uniformInt;
};
}
}
#endif //NET_RANDOM_GENERATOR_H