久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='XtSOf'><style id='XtSOf'><dir id='XtSOf'><q id='XtSOf'></q></dir></style></legend>

          <bdo id='XtSOf'></bdo><ul id='XtSOf'></ul>

        <i id='XtSOf'><tr id='XtSOf'><dt id='XtSOf'><q id='XtSOf'><span id='XtSOf'><b id='XtSOf'><form id='XtSOf'><ins id='XtSOf'></ins><ul id='XtSOf'></ul><sub id='XtSOf'></sub></form><legend id='XtSOf'></legend><bdo id='XtSOf'><pre id='XtSOf'><center id='XtSOf'></center></pre></bdo></b><th id='XtSOf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='XtSOf'><tfoot id='XtSOf'></tfoot><dl id='XtSOf'><fieldset id='XtSOf'></fieldset></dl></div>

        <small id='XtSOf'></small><noframes id='XtSOf'>

        <tfoot id='XtSOf'></tfoot>

        std::mt19937 需要預熱嗎?

        Does std::mt19937 require warmup?(std::mt19937 需要預熱嗎?)

              <i id='frNRB'><tr id='frNRB'><dt id='frNRB'><q id='frNRB'><span id='frNRB'><b id='frNRB'><form id='frNRB'><ins id='frNRB'></ins><ul id='frNRB'></ul><sub id='frNRB'></sub></form><legend id='frNRB'></legend><bdo id='frNRB'><pre id='frNRB'><center id='frNRB'></center></pre></bdo></b><th id='frNRB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='frNRB'><tfoot id='frNRB'></tfoot><dl id='frNRB'><fieldset id='frNRB'></fieldset></dl></div>
              • <bdo id='frNRB'></bdo><ul id='frNRB'></ul>

                <small id='frNRB'></small><noframes id='frNRB'>

                <legend id='frNRB'><style id='frNRB'><dir id='frNRB'><q id='frNRB'></q></dir></style></legend>
                    <tbody id='frNRB'></tbody>
                  <tfoot id='frNRB'></tfoot>
                • 本文介紹了std::mt19937 需要預熱嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我讀到許多偽隨機數生成器需要許多樣本才能預熱".使用 std::random_device 播種 std::mt19937 時是這種情況,還是我們可以期望它在構建后準備就緒?有問題的代碼:

                  I've read that many pseudo-random number generators require many samples in ordered to be "warmed up". Is that the case when using std::random_device to seed std::mt19937, or can we expect that it's ready after construction? The code in question:

                  #include <random>
                  std::random_device rd;
                  std::mt19937 gen(rd());
                  

                  推薦答案

                  Mersenne Twister 是一種基于移位寄存器的 pRNG(偽隨機數生成器),因此會受到長期運行 0 或 1 的壞種子的影響,導致相對可預測的結果,直到內部狀態足夠混合為止.

                  Mersenne Twister is a shift-register based pRNG (pseudo-random number generator) and is therefore subject to bad seeds with long runs of 0s or 1s that lead to relatively predictable results until the internal state is mixed up enough.

                  然而,采用單個值的構造函數在該種子值上使用了一個復雜的函數,該函數旨在最大限度地減少產生這種壞"狀態的可能性.還有第二種初始化 mt19937 的方法,您可以通過符合 SeedSequence 概念的對象直接設置內部狀態.這是第二種初始化方法,您可能需要關注選擇良好"狀態或進行熱身.

                  However the constructor which takes a single value uses a complicated function on that seed value which is designed to minimize the likelihood of producing such 'bad' states. There's a second way to initialize mt19937 where you directly set the internal state, via an object conforming to the SeedSequence concept. It's this second method of initialization where you may need to be concerned about choosing a 'good' state or doing warmup.

                  該標準包含一個符合 SeedSequence 概念的對象,稱為 seed_seq.seed_seq 獲取任意數量的輸入種子值,然后對這些值執行某些操作,以生成適合直接設置 pRNG 內部狀態的不同值序列.

                  The standard includes an object conforming to the SeedSequence concept, called seed_seq. seed_seq takes an arbitrary number of input seed values, and then performs certain operations on these values in order to produce a sequence of different values suitable for directly setting the internal state of a pRNG.

                  以下是加載具有足夠隨機數據的種子序列以填充整個 std::mt19937 狀態的示例:

                  Here's an example of loading up a seed sequence with enough random data to fill the entire std::mt19937 state:

                  std::array<int, 624> seed_data;
                  std::random_device r;
                  std::generate_n(seed_data.data(), seed_data.size(), std::ref(r));
                  std::seed_seq seq(std::begin(seed_data), std::end(seed_data));
                  
                  std::mt19937 eng(seq);
                  

                  這確保了整個狀態是隨機的.此外,每個引擎都指定了它從 seed_sequence 讀取的數據量,因此您可能需要閱讀文檔以找到您使用的任何引擎的信息.

                  This ensures that the entire state is randomized. Also, each engine specifies how much data it reads from the seed_sequence so you may want to read the docs to find that info for whatever engine you use.

                  雖然在這里我完全從 std::random_device 加載了 seed_seq,但指定了 seed_seq 以便只有幾個不是特別隨機的數字應該可以很好地工作.例如:

                  Although here I load up the seed_seq entirely from std::random_device, seed_seq is specified such that just a few numbers that aren't particularly random should work well. For example:

                  std::seed_seq seq{1, 2, 3, 4, 5};
                  std::mt19937 eng(seq);
                  

                  在下面的評論中,Cubbi 表示 seed_seq 通過為您執行預熱序列來工作.

                  In the comments below Cubbi indicates that seed_seq works by performing a warmup sequence for you.

                  以下是您的默認"播種:

                  Here's what should be your 'default' for seeding:

                  std::random_device r;
                  std::seed_seq seed{r(), r(), r(), r(), r(), r(), r(), r()};
                  std::mt19937 rng(seed);
                  

                  這篇關于std::mt19937 需要預熱嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  read input files, fastest way possible?(讀取輸入文件,最快的方法?)
                  The easiest way to read formatted input in C++?(在 C++ 中讀取格式化輸入的最簡單方法?)
                  Reading from .txt file into two dimensional array in c++(從 .txt 文件讀取到 C++ 中的二維數組)
                  How to simulate a key press in C++(如何在 C++ 中模擬按鍵按下)
                  Why doesn#39;t getline(cin, var) after cin.ignore() read the first character of the string?(為什么在 cin.ignore() 之后沒有 getline(cin, var) 讀取字符串的第一個字符?)
                  What is the cin analougus of scanf formatted input?(scanf 格式輸入的 cin 類比是什么?)

                  <small id='UreQH'></small><noframes id='UreQH'>

                  <legend id='UreQH'><style id='UreQH'><dir id='UreQH'><q id='UreQH'></q></dir></style></legend>

                  <tfoot id='UreQH'></tfoot>

                      <tbody id='UreQH'></tbody>

                          • <bdo id='UreQH'></bdo><ul id='UreQH'></ul>

                            <i id='UreQH'><tr id='UreQH'><dt id='UreQH'><q id='UreQH'><span id='UreQH'><b id='UreQH'><form id='UreQH'><ins id='UreQH'></ins><ul id='UreQH'></ul><sub id='UreQH'></sub></form><legend id='UreQH'></legend><bdo id='UreQH'><pre id='UreQH'><center id='UreQH'></center></pre></bdo></b><th id='UreQH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='UreQH'><tfoot id='UreQH'></tfoot><dl id='UreQH'><fieldset id='UreQH'></fieldset></dl></div>
                            主站蜘蛛池模板: 激情网五月天 | 日本一级一片免费视频 | 欧美日韩国产在线 | 99久热| h片在线观看免费 | 国产中文字幕在线 | 日本黄色三级视频 | 日韩不卡在线观看 | 日韩一级av毛片 | 欧美成人精品欧美一级乱黄 | av不卡在线播放 | 国产黄在线观看 | 亚洲精品一二三区 | 激情婷婷 | 久久av片| 免费网站观看www在线观 | 中日韩毛片 | 日韩成人在线观看视频 | 黄色片网站视频 | 四虎在线播放 | 综合网久久 | 性欧美bbw| 国产精品不卡 | 91禁蘑菇在线看 | 天天色天天干天天 | www.粉色视频在线观看 | 久热久草 | 日本在线看 | 日韩成人中文字幕 | 国产网友自拍 | 精品国产精品三级精品av网址 | 99热免费 | 久久久精品一区二区 | 久久久精品 | 五月天婷婷激情 | 久久久久毛片 | 久久机热 | 中文在线观看免费视频 | 国产91精品看黄网站在线观看 | 国产精品免费一区二区三区 | 欧美手机在线 |