FBB::IRandStream(3bobcat)

✨ FBB::IRandStream(3bobcat) β€” Random numbers istream ✨

okay bestie, welcome to the bobcat manual page for FBB::IRandStream πŸ’– this is the section-3 (3bobcat) page, and it's giving "i just want random numbers out of a stream" energy. let's go πŸ¦‹


🌸 NAME 🌸

FBB::IRandStream β€” Istream producing random numbers πŸ’…


✨ SYNOPSIS ✨

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

πŸ’œ DESCRIPTION πŸ’œ

so like, FBB::IRandStream objects? you use them to extract random numbers in a given range from a stream. that's the whole vibe. pull numbers out, they're random, they're in a range, slay. πŸŽ€


🫢 NAMESPACE 🫢

FBB

every constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. no cap. 🌈


πŸ‘‘ INHERITS FROM πŸ‘‘

  • std::istream
  • FBB::RandBuffer (private)

🌟 CONSTRUCTORS 🌟

  • IRandStream(int max) β€” this FBB::IRandStream() constructor initializes the random generator. it uses the default seed (i.e., 1) for the srand(3) function, which means every new run of your program will generate the same sequence of random values 😭 (yes, same numbers every time, it's giving groundhog day). another constructor (see below ⬇️) exists for when that's not it. random values between 1 and max (inclusive) are returned.
  • IRandStream(int min, int max) β€” this FBB::IRandStream() constructor initializes the random generator too. again with the default seed (i.e., 1) for the srand(3) function, so every new run of the program generates the same sequence of random values. and again, another constructor (see below ⬇️) is provided when that's not considered appropriate. random values between min and max (inclusive) are returned.
  • IRandStream(int min, int max, size_t seed) β€” this FBB::IRandStream() constructor initializes the random generator, and this time the seed is used to initialize the random number generator 🌱. if you want to start the random generator at some unpredictable point, time(0) could be used. random values between min and max (inclusive) are returned.
copy and move constructors (and assignment operators) are not available. not me trying to copy one πŸ’€ don't.

🧚 INHERITED MEMBERS 🧚

since the class uses public derivation from std::istream, all members of this class can be used. all of them. the whole squad. 🫢


πŸ”₯ EXAMPLE πŸ”₯

#include <iostream>
#include <bobcat/irandstream>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
{
    if (argc == 1)
        cout << "\n"
                "Showing one random value between 1 and 1000 (inclusive).\n"
                "If you want more values specify the requested number of\n"
                "values as the program’s first argument\n"
                "On repeated calls the same numbers are generated\n\n";

    IRandStream in(1000);

    for (size_t count = argc == 1? 1 : stoul(argv[1]); count--; )
    {
        size_t random;
        in >> random;
        cout << random << endl;
    }
}

πŸŽ€ FILES πŸŽ€

  • bobcat/irandstream β€” defines the class interface

πŸ’… SEE ALSO πŸ’…


πŸ’€ BUGS πŸ’€

None Reported. (iconic behaviour honestly)


🌈 BOBCAT PROJECT FILES 🌈

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.


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


πŸ¦‹ AUTHOR πŸ¦‹

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


okay bestie that's the whole page, you ate that πŸ“ mwah πŸ’‹

libbobcat-dev_6.15.01 Β· 2005-2026 Β· FBB::IRandStream(3bobcat) β€” periodt, go generate some random numbers ✨

πŸ“¦ where this page comes from