Skip to content

Instantly share code, notes, and snippets.

@thawk
Created March 19, 2017 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thawk/36f7e412edd2f5c0887282820ed6aade to your computer and use it in GitHub Desktop.
Save thawk/36f7e412edd2f5c0887282820ed6aade to your computer and use it in GitHub Desktop.
Test boost::random
#include <boost/filesystem/path.hpp>
#include <iostream>
#include <boost/random.hpp>
#include <boost/cstdint.hpp>
#include <boost/integer_traits.hpp>
using boost::filesystem::path;
using namespace std;
int main()
{
boost::random::mt19937 rng;
boost::random::uniform_int_distribution<boost::int64_t> dist(
1, boost::integer_traits<boost::int64_t>::const_max);
for (size_t i=0; i<10; ++i)
{
cout << i << "\t" << dist(rng) << endl;
}
return 0;
}
@thawk
Copy link
Author

thawk commented Mar 19, 2017

Output:

0	1249554814817385309
1	7701594879287229167
2	8936227905722266925
3	2038679211053613062
4	2842339355536804795
5	5047219144592222308
6	1737517050719086789
7	9157713637199080800
8	9190733527922977512
9	8925410424300695386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment