std::experimental::reseed(3)
π¦ std::experimental::reseed(3) π¦
okay bestie, this is the std::experimental::reseed(3) page from the C++ Standard Library manual, and it's giving βtiny reset button for the random vibes.β It's the function that reseeds the per-thread random engine β plus the std::uniform_int_distribution instances that randint is using. π
β¨
πΈ NAME πΈ
std::experimental::reseed - std::experimental::reseed
β¨ Synopsis β¨
Defined in header <experimental/random> β and here's the synopsis block exactly as the page has it, with the overload markers (1) and (2) chilling in the margin:
Defined in header <experimental/random>
void reseed(); (1)
(library fundamentals
TS v2)
void reseed( std::default_random_engine::result_type value (2)
(library fundamentals
); TS v2)
Both overloads are tagged library fundamentals TS v2. The actual job: it reseeds the per-thread random number engine and any std::uniform_int_distribution instances used by randint. (The whole squad gets a fresh start, no cap. π«Ά)
- Sets the per-thread engine to an unpredictable state.
- Seeds the per-thread engine
gas if byg.seed(value).
π Parameters π
valueβ value of the new seed.
π₯ Remarks π₯
Subsequent calls to randint do not depend on values produced by the per-thread engine prior to calling reseed.
π Example π
// Run this code
#include <experimental/random>
#include <iostream>
int main()
{
std::experimental::reseed();
std::cout << "Random 2-digit decimal numbers: ";
for (auto i = 0; i != 3; ++i)
std::cout << std::experimental::randint(10, 99) << ' ';
std::cout << '\n';
}
Possible output:
Random 2-digit decimal numbers: 41 60 56
π See also π
randintβ generates a random integer in the specified range (function template).
That's the whole page, bestie. Source/version + date: http://cppreference.com, 2024.06.10 β std::experimental::reseed(3) out, periodt. π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms