when learning < random > library, only seed_seq does not quite understand
although I went to MSDN, and cppreference, it is not very clear that
there is too little information about seed_seq on
Google.
my understanding is: when a given seed is not very good or the seed distribution in a linear list is not good, but you need a lot of random engines or a lot of entropy generators. You can use seed_seq
. According to the English introduction of cppreference, this is roughly how you understand
an example that seems to understand but does not understand:
-sharpinclude <iostream>
-sharpinclude <random>
using namespace std;
int main(int argc, char *argv[]) {
seed_seq seq {1, 2, 3, 4, 5};
vector<int> vec(10);
seq.generate(vec.begin(), vec.end());
for(const auto &c : vec) {
cout << c << endl;
}
}
I wonder if my understanding is correct, or can you give me some more detailed explanations and examples?