Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <numeric> // iota
- #include <random>
- #include <vector>
- using namespace std;
- int main()
- {
- int len;
- cin >> len;
- vector<int> v(len);
- iota(v.begin(), v.end(), 0); // заполняем 0, 1, 2...
- shuffle(v.begin(), v.end(), std::mt19937{std::random_device{}()}); //перемешиваем
- for (auto x: v) cout << x << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment