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

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

  • <small id='4cgq1'></small><noframes id='4cgq1'>

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

        <bdo id='4cgq1'></bdo><ul id='4cgq1'></ul>

        Rand() % 14 只生成值 6 或 13

        Rand() % 14 only generates the values 6 or 13(Rand() % 14 只生成值 6 或 13)
        <i id='zQwjU'><tr id='zQwjU'><dt id='zQwjU'><q id='zQwjU'><span id='zQwjU'><b id='zQwjU'><form id='zQwjU'><ins id='zQwjU'></ins><ul id='zQwjU'></ul><sub id='zQwjU'></sub></form><legend id='zQwjU'></legend><bdo id='zQwjU'><pre id='zQwjU'><center id='zQwjU'></center></pre></bdo></b><th id='zQwjU'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zQwjU'><tfoot id='zQwjU'></tfoot><dl id='zQwjU'><fieldset id='zQwjU'></fieldset></dl></div>

            • <bdo id='zQwjU'></bdo><ul id='zQwjU'></ul>
                  <tbody id='zQwjU'></tbody>
                <tfoot id='zQwjU'></tfoot>

              • <small id='zQwjU'></small><noframes id='zQwjU'>

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

                  本文介紹了Rand() % 14 只生成值 6 或 13的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  每當我運行以下程序時,返回的值總是 6 或 13.

                  Whenever I run the following program the returned values are always 6 or 13.

                  #include <iostream>
                  #include <fstream>
                  #include <ctime>
                  #include <cstdlib>
                  using namespace std;
                  
                  //void randomLegs();
                  //void randomPush();
                  //void randomPull();
                  //void randomMisc();
                  
                  
                  int main(int argc, const char * argv[])
                  {
                      srand(time(NULL));
                      //randomLegs();
                      cout << rand() % 14;
                      return 0;
                  }
                  

                  今天和昨天我已經運行了將近一百次這個程序.

                  I have run the program close to a hundred times during today and yesterday.

                  誰能告訴我我做錯了什么?

                  Can anyone tell me what I'm doing wrong?

                  謝謝.

                  順便說一下,如果我將 rand() 的范圍更改為 13 或 15,它就可以正常工作.

                  By the way, if I change the range of rand() to say 13 or 15 it works just fine.

                  推薦答案

                  我可以使用 Xcode 5 在 Mac OS X 10.9 上重現該問題 - 看起來它實際上可能是一個錯誤,或者至少是 的限制rand()/srand() 在 OS X 10.9 上.

                  I can reproduce the problem on Mac OS X 10.9 with Xcode 5 - it looks like it might actually be a bug, or at least a limitation with rand()/srand() on OS X 10.9.

                  我建議您使用 arc4random()相反,它比 rand() 效果更好,并且不需要隨機化種子:

                  I recommend you use arc4random() instead, which works a lot better than rand(), and which doesn't require that you randomize the seed:

                  #include <iostream>
                  #include <cstdlib>
                  
                  using namespace std;
                  
                  int main(int argc, const char * argv[])
                  {
                      cout << (arc4random() % 14) << endl;
                      return 0;
                  }
                  

                  測試:

                  $ g++ -Wall -O3 srand.cpp && ./a.out
                  5
                  $ ./a.out
                  8
                  $ ./a.out
                  0
                  $ ./a.out
                  8
                  $ ./a.out
                  11
                  $ ./a.out
                  8
                  $ ./a.out
                  3
                  $ ./a.out
                  13
                  $ ./a.out
                  9
                  $
                  

                  這篇關于Rand() % 14 只生成值 6 或 13的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='QCUZa'></bdo><ul id='QCUZa'></ul>
                      <tbody id='QCUZa'></tbody>
                    <legend id='QCUZa'><style id='QCUZa'><dir id='QCUZa'><q id='QCUZa'></q></dir></style></legend>
                  • <i id='QCUZa'><tr id='QCUZa'><dt id='QCUZa'><q id='QCUZa'><span id='QCUZa'><b id='QCUZa'><form id='QCUZa'><ins id='QCUZa'></ins><ul id='QCUZa'></ul><sub id='QCUZa'></sub></form><legend id='QCUZa'></legend><bdo id='QCUZa'><pre id='QCUZa'><center id='QCUZa'></center></pre></bdo></b><th id='QCUZa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QCUZa'><tfoot id='QCUZa'></tfoot><dl id='QCUZa'><fieldset id='QCUZa'></fieldset></dl></div>
                  • <tfoot id='QCUZa'></tfoot>

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

                            主站蜘蛛池模板: 免费精品一区 | 久久久久国产一区二区三区四区 | 亚洲一区二区三区在线观看免费 | 欧美成人免费在线视频 | 在线国产视频 | 国产yw851.c免费观看网站 | 国产精品久久久久久久午夜 | 91 中文字幕| 精品久久久久久久久久久 | 成人不卡一区二区 | 特级做a爰片毛片免费看108 | 日日夜夜精品视频 | 日韩在线免费看 | 成人免费视频在线观看 | 日日天天| 日韩在线免费视频 | 日韩在线播放视频 | 国产a视频| 亚洲一区久久 | 亚洲视频在线免费观看 | 亚洲精品视频在线播放 | 成人免费一区二区三区牛牛 | 国产精品欧美精品日韩精品 | 国产精品一区二区久久久久 | 中文字幕一区二区在线观看 | 亚洲精品在线视频 | 久久国产精品久久久久久 | 国产欧美一区二区三区在线看 | 91九色在线观看 | 一区二区三区免费 | 国产成人精品免费视频大全最热 | 青青草一区二区 | 91精品国产高清一区二区三区 | 久久免费小视频 | 亚洲一区二区三区四区五区午夜 | 欧美日韩在线播放 | 日韩精品在线看 | 国产成人精品a视频一区www | 久久久青草婷婷精品综合日韩 | 欧美天天视频 | 欧美多人在线 |