FBB::RandomMT(3bobcat) Random Generator using std::mt19937 FBB::RandomMT(3bobcat)

FBB::RandomMT - Class template generating random numbers

#include <bobcat/randommt>
Linking option: -lbobcat

The class template RandomMT uses the std::mt19937 Mercenne Twister to produce random numbers. The class template has one template type parameter, which can be any integral or floating point type. By default size_t-valued random numbers are generated.

All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.


RandomMT<typename Type = size_t>::RandomMT(Type minimum, Type maximum, size_t mtSeed):
The Type template type parameter can be any integral or floating point type. If not specified size_t is used. The parameters minimum and maximum define the range of the generated random values. minimum must be less or equal to maximum, or an exception is thrown. The mtSeed parameter is used to initialize (seed) the mt19937 Mercenne Twister.

The default copy and move constructors and assignment operators are available.

Type operator()():
The function call operator returns the next random value.

#include <iostream>
#include <bobcat/randommt>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)

if (argc == 1)
cout << "arg[1]: minimum value, arg[2]: maximum value,\n"
"arg[3]: (optional) seed (or time(0))\n";
return 0;
// specify, e.g., RandomMt<double> to generate random double values
RandomMT<> rmt( stoull(argv[1]), stoull(argv[2]),
argc >= 4 ? stoull(argv[3]) : time(0) );
while (true)
cout << rmt() << "\n"
"Enter: next";
cin.ignore(1000, ’\n’);
} } catch (exception const &exc) {
cerr << exc.what() << ’\n’; }

bobcat/randommt - defines the class interface

bobcat(7), irandstream(3bobcat), rand(3), randbuf(3bobcat), srand(3)

None Reported.

https://fbb-git.gitlab.io/bobcat/: gitlab project page;
bobcat_6.02.02-x.dsc: detached signature;
bobcat_6.02.02-x.tar.gz: source archive;
bobcat_6.02.02-x_i386.changes: change log;
libbobcat1_6.02.02-x_*.deb: debian package containing the libraries;
libbobcat1-dev_6.02.02-x_*.deb: debian package containing the libraries, headers and manual pages;

Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.

This is free software, distributed under the terms of the GNU General Public License (GPL).

Frank B. Brokken (f.b.brokken@rug.nl).

2005-2022 libbobcat-dev_6.02.02