std::binomi...ution::param(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay bestie, you're on the std::binomi...ution::param(3) page of the C++ Standard Libary manual β€” yes, that's the title and the manual name folded in near the top, we're not copy-pasting the header line, we're vibing ✨

  • std::binomial_distribution::param - std::binomial_distribution::param β€” that's the name, twice, because the page said so and we respect the page πŸ’…

✨ Synopsis ✨

param_type param() const;               (1) (since C++11)
void param( const param_type& params ); (2) (since C++11)

The way that this whole thing manages the associated distribution parameter set? iconic. no cap.

  1. Returns the associated parameter set. 🫢
  2. Sets the associated parameter set to params. πŸ’–

πŸŽ€ Parameters πŸŽ€

  • params β€” new contents of the associated parameter set 🌸

πŸ¦‹ Return value πŸ¦‹

  1. The associated parameter set.
  2. (none)

⭐ Complexity ⭐

Constant. literally constant, bestie, that's the whole vibe.

🌈 Example 🌈

run this code, it's giving random binomial realness πŸ‘‘

       // Run this code

        #include <iostream>
        #include <random>

        int main()
        {
            std::random_device rd;
            std::mt19937 gen(rd());
            using BinomialDist = std::binomial_distribution<>;
            BinomialDist bino_dis(1, 0.5);

            std::cout << "A sample of Binomial(  1, 0.5): " << bino_dis(gen) <<
       '\n';

            // Use another parameter set
            bino_dis.param(BinomialDist::param_type(100,0.9));
            std::cout << "A sample of Binomial(100, 0.9): " << bino_dis(gen) <<
       '\n';
        }

Possible output:

A sample of Binomial(  1, 0.5): 0
A sample of Binomial(100, 0.9): 94

and that's the page, bestie 🫢 the footer shoutout goes to http://cppreference.com, the date/version 2024.06.10, and the icon herself: std::binomi...ution::param(3) πŸ’…βœ¨

πŸ“¦ where this page comes from