| 1 | #include <boost/random/mersenne_twister.hpp>
|
|---|
| 2 | #include <boost/random/uniform_int.hpp>
|
|---|
| 3 | #include <iostream>
|
|---|
| 4 |
|
|---|
| 5 | using boost::mt19937;
|
|---|
| 6 | using boost::uniform_int;
|
|---|
| 7 |
|
|---|
| 8 | class MGen {
|
|---|
| 9 | public:
|
|---|
| 10 | typedef mt19937::result_type result_type;
|
|---|
| 11 |
|
|---|
| 12 | result_type min() const { return impl_.min(); }
|
|---|
| 13 | result_type max() const { return impl_.max(); }
|
|---|
| 14 |
|
|---|
| 15 | result_type operator()()
|
|---|
| 16 | {
|
|---|
| 17 | return 2114502989;
|
|---|
| 18 | }
|
|---|
| 19 | private:
|
|---|
| 20 | mt19937 impl_;
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 | int main()
|
|---|
| 24 | {
|
|---|
| 25 | typedef boost::int64_t number;
|
|---|
| 26 | MGen gen;
|
|---|
| 27 | std::cout << uniform_int<number>(-50, 50)(gen) << std::endl;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|