Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::reseed

      From cppreference.com
      <cpp‎ |experimental
       
       
       
       
      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)

      Reseeds theper-thread random number engine and anystd::uniform_int_distribution instances used byrandint.

      1) Sets the per-thread engine to an unpredictable state.
      2) Seeds the per-thread engineg as if byg.seed(value).

      Contents

      [edit]Parameters

      value - value of the new seed

      [edit]Remarks

      Subsequent calls torandint do not depend on values produced by the per-thread engine prior to callingreseed.

      [edit]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

      [edit]See also

      generates a random integer in the specified range
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/reseed&oldid=155684"

      [8]ページ先頭

      ©2009-2025 Movatter.jp