Ticket #10364: boost-r3.cpp

File boost-r3.cpp, 865 bytes (added by mouse008@…, 8 years ago)

Source code that demonstrates the problem

Line 
1#include <iostream>
2#include <boost/multiprecision/gmp.hpp>
3#include <boost/multiprecision/random.hpp>
4
5using namespace boost::multiprecision;
6using namespace boost::random;
7
8int main() {
9
10 unsigned long long myseed = 0x12345670;
11 mt19937 rgen(myseed);
12
13 //
14 // Generate some values:
15 //
16 std::cout << std::hex
17 // << std::showbase
18 ;
19
20 independent_bits_engine<mt19937, 50L*1000L/301L, mpz_int> gen2(rgen);
21 independent_bits_engine<mt19937, 100, mpf_float_50> gen3(rgen);
22 uniform_real_distribution<mpf_float_50> ur(-20, 20);
23 //
24 // Generate some values:
25 //
26 std::cout << std::setprecision(50);
27 for(unsigned i = 0; i < 20; ++i)
28 std::cout << std::setw(2) << (i+1) << ": "
29 << std::setw(20)
30 << ur(gen3) << " "
31 // << ur(gen2) << " "
32 // << ur(rgen)
33 << std::endl;
34 std::cout << std::endl;
35}