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

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

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

        <bdo id='uz3Tj'></bdo><ul id='uz3Tj'></ul>
      1. 改變uniform_int_distribution的范圍

        Vary range of uniform_int_distribution(改變uniform_int_distribution的范圍)
      2. <tfoot id='ds5gq'></tfoot>
          <bdo id='ds5gq'></bdo><ul id='ds5gq'></ul>

          • <legend id='ds5gq'><style id='ds5gq'><dir id='ds5gq'><q id='ds5gq'></q></dir></style></legend>
          • <small id='ds5gq'></small><noframes id='ds5gq'>

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

                  <tbody id='ds5gq'></tbody>

                1. 本文介紹了改變uniform_int_distribution的范圍的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我有一個隨機對象:

                  So i have a Random object:

                  typedef unsigned int uint32;
                  
                  class Random {
                  public:
                      Random() = default;
                      Random(std::mt19937::result_type seed) : eng(seed) {}
                  
                  private:
                      uint32 DrawNumber();
                      std::mt19937 eng{std::random_device{}()};
                      std::uniform_int_distribution<uint32> uniform_dist{0, UINT32_MAX};
                  };
                  
                  uint32 Random::DrawNumber()
                  {
                      return uniform_dist(eng);
                  }
                  

                  我可以改變(通過另一個函數或其他方式)分布上限的最佳方法是什么?

                  What's the best way I can vary (through another function or otherwise) the upper bound of of the distribution?

                  (也愿意接受其他風格問題的建議)

                  (also willing to take advice on other style issues)

                  推薦答案

                  分發對象是輕量級的.當您需要隨機數時,只需構建一個新的分布.我在游戲引擎中使用這種方法,經過基準測試后,它可以與使用舊的 rand() 相媲美.

                  Distribution objects are lightweight. Simply construct a new distribution when you need a random number. I use this approach in a game engine, and, after benchmarking, it's comparable to using good old rand().

                  此外,我在 GoingNative 2013 直播中詢問了如何改變分發范圍,標準委員會成員 Stephen T. Lavavej 建議簡單地創建新分發,因為它不應該是表演問題.

                  Also, I've asked how to vary the range of distribution on GoingNative 2013 live stream, and Stephen T. Lavavej, a member of the standard committee, suggested to simply create new distributions, as it shouldn't be a performance issue.

                  以下是我將如何編寫您的代碼:

                  Here's how I would write your code:

                  using uint32 = unsigned int;
                  
                  class Random {
                  public:
                      Random() = default;
                      Random(std::mt19937::result_type seed) : eng(seed) {}
                      uint32 DrawNumber(uint32 min, uint32 max);
                  
                  private:        
                      std::mt19937 eng{std::random_device{}()};
                  };
                  
                  uint32 Random::DrawNumber(uint32 min, uint32 max)
                  {
                      return std::uniform_int_distribution<uint32>{min, max}(eng);
                  }
                  

                  這篇關于改變uniform_int_distribution的范圍的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 類比是什么?)

                  <tfoot id='yM9Tn'></tfoot>

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

                    1. <legend id='yM9Tn'><style id='yM9Tn'><dir id='yM9Tn'><q id='yM9Tn'></q></dir></style></legend>

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

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

                          • 主站蜘蛛池模板: 久久久久久国产精品免费免费 | 亚洲国产高清高潮精品美女 | 日韩在线欧美 | 欧美一区二区激情三区 | 亚洲性视频网站 | 91视视频在线观看入口直接观看 | 国产一区中文 | 免费看黄视频网站 | 天堂中文av | 欧美成人免费在线视频 | 欧美性一区二区三区 | 久久精品亚洲国产 | 6080亚洲精品一区二区 | 欧美a区 | 午夜免费视频 | 午夜精品久久久久久 | 一区二区不卡视频 | 91视频久久 | 成人午夜黄色 | 欧美日韩在线精品 | 久久精品无码一区二区三区 | 亚洲导航深夜福利涩涩屋 | 在线免费观看亚洲 | 亚洲国产精久久久久久久 | 精品亚洲一区二区三区四区五区 | 婷婷久久网 | 精品国产高清一区二区三区 | 99精品久久 | 一区二区三区四区av | 欧美视频一区二区三区 | 性福视频在线观看 | 在线视频中文字幕 | 国产精品久久国产精品 | 特级生活片 | 成人国产毛片 | 国产精品爱久久久久久久 | 91.xxx.高清在线 | 97精品超碰一区二区三区 | 亚洲久草 | 精品视频在线观看 | 亚洲精品乱码久久久久久按摩 |