• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會(huì)很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::
            You should use the arc4random() function. It uses a superior algorithm to rand. You don't even need to set a seed.
            arc4random, arc4random_stir, arc4random_addrandom -- arc4 random number generator

            Same as C, you would do
            int r = rand() % 74; // [0, 74)

            Feel free to substitute random() or arc4random() for rand() (which is, as others have pointed out, quite sucky).

            srandom((unsigned int)time(NULL)); // 防止出現(xiàn)警告



            arc4random_uniform(74); // [0, 74)

            arc4random_uniform(upper_bound) avoids modulo bias as described in the man page:

            arc4random_uniform() will return a uniformly distributed random number less than upper_bound. arc4random_uniform() is recommended over constructions like ``arc4random() % upper_bound'' as it avoids "modulo bias" when the upper bound is not a power of two.


            生成[0, 1)之間的隨機(jī)數(shù)

            arc4random_uniform(100) / 100.0

            @import url(http://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
            posted on 2011-12-07 23:23 逛奔的蝸牛 閱讀(1308) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Cocoa
            久久夜色精品国产网站| 久久国产精品久久国产精品| 欧美日韩久久中文字幕| 欧美熟妇另类久久久久久不卡| 亚洲精品乱码久久久久66| 亚洲国产精品一区二区久久| 伊人久久一区二区三区无码| 国产精品久久波多野结衣| 香蕉久久夜色精品国产2020| 伊人久久综在合线亚洲2019| 伊人久久综合精品无码AV专区| 97久久精品人人做人人爽| 人妻无码中文久久久久专区| 亚洲精品美女久久久久99小说| …久久精品99久久香蕉国产| 久久久久久久久久久久久久| 狠狠人妻久久久久久综合| 69国产成人综合久久精品| 日韩精品无码久久久久久| 国产巨作麻豆欧美亚洲综合久久 | 久久精品亚洲乱码伦伦中文| 狠狠精品久久久无码中文字幕| 久久青青草原精品国产软件| 久久中文字幕一区二区| 久久精品国产亚洲av麻豆小说| 久久久久国产精品嫩草影院| 亚洲国产精品成人AV无码久久综合影院| 久久99精品国产| 亚洲av伊人久久综合密臀性色 | 精品综合久久久久久98| 午夜精品久久久久| 国产精品久久久久久久app| 思思久久99热免费精品6| 四虎久久影院| 人人妻久久人人澡人人爽人人精品| 丰满少妇人妻久久久久久4| 国内精品伊人久久久久网站| 久久精品无码一区二区三区日韩| 久久亚洲欧洲国产综合| 国产精品久久婷婷六月丁香| 久久亚洲AV成人无码软件|