#include <iostream>
#include <vector>
#include <functional>
#include <random>
void a() { std::cout << "a "; }
void b() { std::cout << "b "; }
void c() { std::cout << "c "; }
void d() { std::cout << "d "; }
void e() { std::cout << "e "; }
int main()
{
std::vector<std::function<void()>> functions = {a,b,c,d,e};
std::random_device rd;
std::mt19937 gen(rd());
std::discrete_distribution<> d({10, 10, 10, 1, 10});
// call them randomly (with d() 10 times less likely)
for(int n = 0; n < 30; ++n)
functions[d(gen)]();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KI2luY2x1ZGUgPHJhbmRvbT4KCnZvaWQgYSgpIHsgc3RkOjpjb3V0IDw8ICJhICI7IH0Kdm9pZCBiKCkgeyBzdGQ6OmNvdXQgPDwgImIgIjsgfQp2b2lkIGMoKSB7IHN0ZDo6Y291dCA8PCAiYyAiOyB9CnZvaWQgZCgpIHsgc3RkOjpjb3V0IDw8ICJkICI7IH0Kdm9pZCBlKCkgeyBzdGQ6OmNvdXQgPDwgImUgIjsgfQoKaW50IG1haW4oKQp7CiAgICBzdGQ6OnZlY3RvcjxzdGQ6OmZ1bmN0aW9uPHZvaWQoKT4+IGZ1bmN0aW9ucyA9IHthLGIsYyxkLGV9OwoKICAgIHN0ZDo6cmFuZG9tX2RldmljZSByZDsKICAgIHN0ZDo6bXQxOTkzNyBnZW4ocmQoKSk7CiAgICBzdGQ6OmRpc2NyZXRlX2Rpc3RyaWJ1dGlvbjw+IGQoezEwLCAxMCwgMTAsIDEsIDEwfSk7CgogICAgLy8gY2FsbCB0aGVtIHJhbmRvbWx5ICh3aXRoIGQoKSAxMCB0aW1lcyBsZXNzIGxpa2VseSkKICAgIGZvcihpbnQgbiA9IDA7IG4gPCAzMDsgKytuKQogICAgICAgIGZ1bmN0aW9uc1tkKGdlbildKCk7Cn0K