.TH "FBB::RandomMT" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "Random Generator using std::mt19937" .PP .SH "NAME" FBB::RandomMT \- Class template generating random numbers .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" The class template \fIRandomMT\fP uses the \fIstd::mt19937\fP 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 \fIsize_t\fP\-valued random numbers are generated\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \- .PP .SH "CONSTRUCTORS" .IP o \fBRandomMT::RandomMT(Type minimum, Type maximum, size_t mtSeed)\fP: .br The \fIType\fP template type parameter can be any integral or floating point type\&. If not specified \fIsize_t\fP is used\&. The parameters \fIminimum\fP and \fImaximum\fP define the range of the generated random values\&. \fIminimum\fP must be less or equal to \fImaximum\fP, or an exception is thrown\&. The \fImtSeed\fP parameter is used to initialize (seed) the \fImt19937\fP Mercenne Twister\&. .PP The default copy and move constructors and assignment operators are available\&. .PP .SH "OVERLOADED OPERATORS" .IP o \fBType operator()()\fP: .br The function call operator returns the next random value\&. .PP .SH "EXAMPLE" .nf #include #include using namespace std; using namespace FBB; int main(int argc, char **argv) try { if (argc == 1) { cout << \(dq\&arg[1]: minimum value, arg[2]: maximum value,\en\(dq\& \(dq\&arg[3]: (optional) seed (or time(0))\en\(dq\&; return 0; } // specify, e\&.g\&., RandomMt to generate random double values RandomMT<> rmt( stoull(argv[1]), stoull(argv[2]), argc >= 4 ? stoull(argv[3]) : time(0) ); while (true) { cout << rmt() << \(dq\&\en\(dq\& \(dq\&Enter: next\(dq\&; cin\&.ignore(1000, \(cq\&\en\(cq\&); } } catch (exception const &exc) { cerr << exc\&.what() << \(cq\&\en\(cq\&; } .fi .PP .SH "FILES" \fIbobcat/randommt\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBirandstream\fP(3bobcat), \fBrand\fP(3), \fBrandbuf\fP(3bobcat), \fBsrand\fP(3) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP