Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <chrono>
- #include <iostream>
- #include <random>
- #include <vector>
- using namespace std;
- void foo(vector<double> a, int n) {
- int i = 0;
- for (auto& e : a) {
- cout << e << ' ';
- if (++i % n == 0) cout << endl;
- }
- }
- int main() {
- int n;
- cin >> n;
- mt19937 g(chrono::system_clock::now().time_since_epoch().count());
- uniform_real_distribution<double> rnd(0., 1.);
- vector<double> box(n * n);
- for (auto& e : box)
- e = rnd(g);
- foo(box, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement