FBB::RandBuffer(3bobcat)
β¨ FBB::RandBuffer β¨
okay so bestie, welcome to FBB::RandBuffer from the bobcat manual pages β the little std::streambuf that's out here just generating random numbers for you π
it's giving chaos, but make it a stream. iykyk.
πΈ NAME πΈ
FBB::RandBuffer β a std::streambuf that generates random numbers π₯
π¦ SYNOPSIS π¦
#include <bobcat/randbuf>
Linking option: -lbobcat
π DESCRIPTION π
So like, FBB:RandBuffer objects can be used as the std::streambuf of std::istream objects, which means you can straight up extract random numbers from the stream. no cap. you read from an istream and the vibes are simply random numbers. iconic. π
π NAMESPACE π
FBB
Every single constructor, member, operator and manipulator that gets mentioned in this man page lives in the namespace FBB. all of them. periodt.
π INHERITS FROM π
std::streambuf
β CONSTRUCTOR β
RandBuf(int min, int max, size_t seed = 1)β thisRandBuf()constructor gets the random generator set up and ready to slay. theseedis what initializes the random number generator. random values betweenminandmax, inclusive, are what you get back π«Ά
π¨ not me being the bearer of bad news: the copy and move constructors (and the assignment operators) are not available. nope. not a thing. (and there's a lone stray backtick dangling at the end of that line in the original, we don't talk about it π)
π VIRTUAL MEMBERS π
int underflow()βstd::istreamobjects that are usingRandBufare the ones that call this function. it produces the next random number that's available, and it separates the random numbers by one blanks space. random values betweenminandmax, inclusive, come back out of it (peep the constructor description above for that π ).
π§ INHERITED MEMBERS π§
since the class uses public derivation from std::streambuf, literally all members of that class can be used. everything. the whole menu. obsessed.
π EXAMPLE π
#include <iostream>
#include <istream>
#include <bobcat/randbuf>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
if (argc == 1)
{
cout << "expect: nruns min max seed\n";
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 << "extraction failed\n";
break;
}
cout << "next: " << c << endl;
}
int count = 0;
while (istr.unget())
count++;
cout << "number of successful unget()-calls: " << count << endl;
istr.clear();
istr >> count;
cout << "and read: " << count << endl;
}
π₯ FILES π₯
bobcat/randbuf β defines the class interface β¨
π SEE ALSO π
bobcat(7), irandstream(3bobcat), randommt(3bobcat), std::streambuf
π BUGS π
None Reported. (we stay unproblematic π«Ά)
πΈ BOBCAT PROJECT FILES πΈ
- https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
π¦ BOBCAT π¦
Bobcat is an acronym of `Brokkenβs Own Base Classes And Templatesβ. π
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL). slay, honestly.
β AUTHOR β
Frank B. Brokken (f.b.brokken@rug.nl).
and that's the whole page bestie!! π
β¨ this masterpiece lives in libbobcat-dev_6.15.01, dated 2005-2026. go forth and generate random numbers, main character ππ«Ά
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms