#include <vector>
#include <algorithm>
#include <cstdlib>
#include <iostream>

template<class bidiiter>
bidiiter random_unique(bidiiter begin, bidiiter end, size_t num_random) {
    size_t left = std::distance(begin, end);
    while (num_random--) {
        bidiiter r = begin;
        std::advance(r, rand()%left);
        std::swap(*begin, *r);
        ++begin;
        --left;
    }
    return begin;
}

int main() {
    std::vector<int> a(10000);
    for(int i=0; i<10000; ++i)
        a[i] = i;
    random_unique(a.begin(), a.end(), 13);
    for(int i=0; i<13; ++i) {
        std::cout << a[i] << '\n';
    }
    return 0;
}