public member function
<random>

std::seed_seq::generate

template <class RandomAccessIterator>  void generate (RandomAccessIterator first, RandomAccesIterator last);
Generate sequence
Fills the supplied sequence with a sequence 32-bit values that can be used to seed a pseudo-random number generator engine.

The values are generated using an algorithm that takes into account the internal sequence with which the object was initialized.

Parameters

first, last
Random access 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 shall be a mutable random access iterator that points to elements of an integer type capable of accommodating 32-bit values.

Return value

none

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// seed_seq::generate
#include <iostream>
#include <random>
#include <array>

int main ()
{
  std::seed_seq seed = {102,406,7892};

  std::cout << "generating a sequence of 5 elements:" << std::endl;
  std::array<unsigned,5> sequence;
  seed.generate(sequence.begin(),sequence.end());
  for (unsigned x:sequence) {std::cout << x << std::endl;}

  return 0;
}

Possible output:
generating a sequence of 5 elements:
1744849824
2338808733
1540432678
2581311530
937904459


Complexity

Linear on last-first.

See also