public member function
<random>
std::seed_seq::seed_seq (1)seed_seq();(2)
template<class T> seed_seq (initializer_list<T> il);(3)
template<class InputIterator> seed_seq (InputIterator first, InputIterator last);
Seed sequence constructor
Constructs a seed_seq object, and initializes its internal sequence to a sequence with the same number of elements as the sequence defined by its initialization arguments (zero, for the default constructor).It then copies the values into the internal sequence, which is made of elements of at least 32 bits. In the standard seed_seq class (with elements of type uint_least32_t), each element in the initialization arguments corresponds to one element in the internal sequence: mismatching sizes are adjusted either by zero-padding or trimming the passed values accordingly.
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;
}
generating a sequence of 5 elements: 3115361211 4052619055 1473326094 3552077780 2602119476
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4