1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
// seed_seq constructor
#include <iostream>
#include <random>
#include <string>
#include <array>
int main ()
{
std::seed_seq seed1;
std::seed_seq seed2 = {102,406,7892};
std::string foo = "Seeding a RNG";
std::seed_seq seed3 (foo.begin(),foo.end());
std::cout << "generating a sequence of 5 elements:" << std::endl;
std::array<unsigned,5> sequence;
seed3.generate(sequence.begin(),sequence.end());
for (unsigned x:sequence) {std::cout << x << std::endl;}
return 0;
}
|