Untitled
unknown
c_cpp
2 years ago
585 B
2
Indexable
Never
#include <vector> #include <ranges> #include <iostream> #include <random> using namespace std; auto dstrb() { static uniform_int_distribution<int> distr{ 0, 16 }; static random_device device; static mt19937 engine{ device() }; return distr(engine); } template <ranges::range R> void RandGen(R&& r) { ranges::generate(r, dstrb); } template <ranges::range R> void prntOut(R&& a) { for (auto x : a) { cout << x << endl; } } int main() { std::vector<int> vect(16); RandGen(vect); prntOut(vect); }