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.

Parameters

il
An initializer_list object, with elements of an integer type.
These objects are automatically constructed from initializer list declarators.
T shall be an integer type.
first, last
Input iterators to the initial and final positions in a range. The range used is [first,last), which includes all the elements between first and last, including the element pointed by first but not the element pointed by last.
The function template type can be any type of input iterator that points to elements of an integer type.

Example

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;
}

Possible output:
generating a sequence of 5 elements:
3115361211
4052619055
1473326094
3552077780
2602119476


Complexity

Linear on the sequence size.

See also