কম্পিউটার টিউটোরিয়াল

সি++-এ negative_binomial_distribution উদাহরণসহ (negative_binomial_distribution in C++ with Examples)


এই টিউটোরিয়ালে, আমরা সি++-এ negative_binomial_distribution সম্পর্কে আলোচনা করব।

এই ফাংশন নেগেটিভ বাইনোমিয়াল ডিসক্রিট ডিস্ট্রিবিউশন অনুসরণ করে এবং এই র‍্যান্ডম ডিস্ট্রিবিউশন অনুযায়ী পূর্ণসংখ্যা প্রডিউস করে।

উদাহরণ

#include <bits/stdc++.h> using namespace std; int main() {    // পরীক্ষার সংখ্যা সেট    const int exps = 10000;    const int numberstars = 100;    default_random_engine generator;    negative_binomial_distribution<int> distribution(4, 0.5);    int p[10] = {};    for (int i = 0; i < exps; ++i) {       int counting = distribution(generator);       if (counting < 10)          ++p[counting];    }    cout << "Negative binomial distribution with "<< "( k = 4, p = 0.5 ) :" << endl;    // অ্যারে থেকে সিকোয়েন্স প্রিন্ট    for (int i = 0; i < 10; ++i)       cout << i << ": " << string(p[i] * numberstars / exps, '*') << endl;    return 0; }

আউটপুট

Negative binomial distribution with ( k = 4, p = 0.5 ) : 0: ***** 1: ************ 2: **************** 3: *************** 4: ************* 5: ********** 6: ******** 7: ***** 8: *** 9: **

  1. সি++ STL-এ মাল্টিসেট max_size() উদাহরণসহ (multiset max_size() in C++ STL with Examples)

  2. সি++ STL-এ মাল্টিসেট size() উদাহরণসহ (multiset size() in C++ STL with Examples)

  3. C++-এ স্ব্যাপ দিয়ে সবচেয়ে ছোট স্ট্রিং পাওয়া

  4. C++ STL-এ array::data() মেথড উদাহরণসহ