std::seed_seq (3) - Linux Manuals
std::seed_seq: std::seed_seq
Command to display std::seed_seq
manual in Linux: $ man 3 std::seed_seq
NAME
std::seed_seq - std::seed_seq
Synopsis
Defined in header <random>
class seed_seq; (since C++11)
std::seed_seq consumes a sequence of integer-valued data and produces a requested number of unsigned integer values i, 0 ≤ i < 232
, based on the consumed data. The produced values are distributed over the entire 32-bit range even if the consumed values are close.
It provides a way to seed a large number of random number engines or to seed a generator that requires a lot of entropy, given a small seed or a poorly distributed initial seed sequence.
std::seed_seq meets the requirements of SeedSequence.
Member types
Member type Definition
result_type std::uint_least32_t
Member functions
constructs and seeds the std::seed_seq object
constructor (public member function)
operator= not copy-assignable
(public member function)
(deleted)
calculates the bias-eliminated, evenly distributed 32-bit values
generate (public member function)
obtains the number of 32-bit values stored in std::seed_seq
size (public member function)
obtains the 32-bit values stored in std::seed_seq
param (public member function)
Example
// Run this code
#include <random>
#include <cstdint>
#include <iostream>
int main()
{
std::seed_seq seq{1,2,3,4,5};
std::vector<std::uint32_t> seeds(10);
seq.generate(seeds.begin(), seeds.end());
for (std::uint32_t n : seeds) {
std::cout << n << '\n';
}
}
Output:
4204997637
4246533866
1856049002
1129615051
690460811
1075771511
46783058
3904109078
1534123438
1495905678
Pages related to std::seed_seq
- std::seed_seq::generate (3) - std::seed_seq::generate
- std::seed_seq::param (3) - std::seed_seq::param
- std::seed_seq::seed_seq (3) - std::seed_seq::seed_seq
- std::seed_seq::size (3) - std::seed_seq::size
- std::search (3) - std::search
- std::search_n (3) - std::search_n
- std::set (3) - std::set
- std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin (3) - std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin
- std::set<Key,Compare,Allocator>::clear (3) - std::set<Key,Compare,Allocator>::clear
- std::set<Key,Compare,Allocator>::contains (3) - std::set<Key,Compare,Allocator>::contains
- std::set<Key,Compare,Allocator>::count (3) - std::set<Key,Compare,Allocator>::count