.TH "FBB::RandBuffer" "3bobcat" "2005\-2020" "libbobcat\-dev_5\&.07\&.00" "random number streambuf" .PP .SH "NAME" FBB::RandBuffer \- std::streambuf generating random numbers .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" .PP \fBFBB:RandBuffer\fP objects may be used as a \fBstd::streambuf\fP of \fIstd::istream\fP objects to allow the extraction of random numbers from the stream\&. .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" std::streambuf .PP .SH "CONSTRUCTOR" .IP o \fBRandBuf(int min, int max, size_t seed = 1)\fP: .br This \fBRandBuf()\fP constructor initializes the random generator\&. The seed is used to initialize the random number generator\&.Random values between \fImin\fP and \fImax\fP (inclusive) are returned\&. .PP Copy and move constructors (and assignment operators) are not available\&. ` .SH "VIRTUAL MEMBERS" .PP .IP o \fBint underflow()\fP: .br This function is called by \fIstd::istream\fP objects using \fBRandBuf\fP\&. It produces the next available random number, separating the random numbers by one blanks space\&. Random values between \fImin\fP and \fImax\fP (inclusive) are returned (see the description of the constructor)\&. .PP .SH "INHERITED MEMBERS" .PP Since the class uses public derivation from \fBstd::streambuf\fP, all members of this class can be used\&. .PP .SH "EXAMPLE" .nf #include #include #include \(dq\&\&.\&./randbuf\(dq\& using namespace std; using namespace FBB; int main(int argc, char **argv) { if (argc == 1) { cout << \(dq\&expect: nruns min max seed\en\(dq\&; return 1; } RandBuf rb(stoi(argv[2]), stoi(argv[3]), stoul(argv[4])); istream istr(&rb); for (unsigned idx = stoul(argv[1]); idx\-\-; ) { int c; if (!(istr >> c)) { cout << \(dq\&extraction failed\en\(dq\&; break; } cout << \(dq\&next: \(dq\& << c << endl; } int count = 0; while (istr\&.unget()) count++; cout << \(dq\&number of successful unget()\-calls: \(dq\& << count << endl; istr\&.clear(); istr >> count; cout << \(dq\&and read: \(dq\& << count << endl; } .fi .PP .SH "FILES" \fIbobcat/randbuf\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBirandstream\fP(3bobcat), \fBrand\fP(3), \fBsrand\fP(3), \fBstd::streambuf\fP .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_5\&.07\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_5\&.07\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_5\&.07\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_5\&.07\&.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