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

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

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

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

      • <bdo id='CZGnm'></bdo><ul id='CZGnm'></ul>
    1. <tfoot id='CZGnm'></tfoot>
    2. 需要一個快速的 C++ 隨機生成器

      Need a fast random generator for c++(需要一個快速的 C++ 隨機生成器)

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

        <small id='2fUyu'></small><noframes id='2fUyu'>

          <legend id='2fUyu'><style id='2fUyu'><dir id='2fUyu'><q id='2fUyu'></q></dir></style></legend>

              <bdo id='2fUyu'></bdo><ul id='2fUyu'></ul>
              1. 本文介紹了需要一個快速的 C++ 隨機生成器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試在我的 TSP 生成器上對歐幾里德距離進行一些 opt-3 交換,并且由于在許多情況下我有超過 500 個節點,因此我需要隨機選擇我想要的 3 個節點中的至少 1 個嘗試交換.

                I'm trying to do some opt-3 swapping on my TSP generator for euclidian distances, and since I in many cases have more than ~500 nodes, I need to randomly select at least 1 of the 3 nodes that I want to try swapping.

                所以基本上我需要一個快速的隨機數函數.(普通的 rand() 太慢了)它不必很棒,只要 足夠.

                So basically I need a random-number function that's fast. (the normal rand() is way too slow) It doesn't have to be awesome, just good enough.

                我忘了說,我所處的環境除了標準語言庫(例如 STL、iostream 等)之外,我無法添加任何庫.所以沒有提升 =/

                I forgot to mention, i'm sitting at an environment where I can't add any libraries except the Standard Language Library (such as STL, iostream etc). So no boost =/

                推薦答案

                另一個帖子提到了 Marsaglia 的 xorshf 生成器,但沒有人貼出代碼.

                The other thread mentioned Marsaglia's xorshf generator, but no one posted the code.

                static unsigned long x=123456789, y=362436069, z=521288629;
                
                unsigned long xorshf96(void) {          //period 2^96-1
                unsigned long t;
                    x ^= x << 16;
                    x ^= x >> 5;
                    x ^= x << 1;
                
                   t = x;
                   x = y;
                   y = z;
                   z = t ^ x ^ y;
                
                  return z;
                }
                

                我到處都在使用這個.唯一失敗的地方是我嘗試生成隨機二進制矩陣時.超過大約 95x95 的矩陣,它開始生成太少或太多的奇異矩陣(我忘記了哪個).已經證明該發生器等效于線性移位反饋寄存器.但是除非你在做密碼學或認真的蒙特卡洛工作,否則這個生成器會很厲害.

                I've used this one all over the place. The only place it failed was when I was trying to produce random binary matrices. Past about 95x95 matrices, it starts generating too few or too many singular matrices (I forget which). It's been shown that this generator is equivalent to a linear shift feedback register. But unless you are doing cryptography or serious monte carlo work, this generator rocks.

                這篇關于需要一個快速的 C++ 隨機生成器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 類比是什么?)
                  • <bdo id='w4xzT'></bdo><ul id='w4xzT'></ul>

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

                      1. <small id='w4xzT'></small><noframes id='w4xzT'>

                          主站蜘蛛池模板: 99精品国产一区二区青青牛奶 | 国产美女精品视频 | 欧美 日韩 中文 | 操操日| 刘亦菲国产毛片bd | 97精品超碰一区二区三区 | av在线黄 | 黄色在线网站 | 国产成人精品一区二区在线 | 四虎永久影院 | 日本电影韩国电影免费观看 | 99热视| 亚洲二区在线 | 中文字幕在线精品 | 国产精品美女 | jlzzjlzz国产精品久久 | 午夜影院毛片 | 97超碰人人| 国产一区二区观看 | 男女搞网站 | 91麻豆产精品久久久久久夏晴子 | 亚洲一二三区精品 | 在线国产视频观看 | 国产精品自产拍在线观看蜜 | 一区二区蜜桃 | 亚洲国产精品一区二区三区 | 亚洲大片一区 | 91亚洲国产成人久久精品网站 | 福利一区二区 | 天堂免费看片 | 亚洲+变态+欧美+另类+精品 | 99精品99 | 久草福利 | 一个色在线 | 华人黄网站大全 | 精品欧美一区免费观看α√ | 91偷拍精品一区二区三区 | 国产视频1区| 久久精品成人 | 一区二区三区av夏目彩春 | 精一区二区 |