• <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>

            逛奔的蝸牛

            我不聰明,但我會很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::
            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)); // 防止出現警告



            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)之間的隨機數

            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 逛奔的蝸牛 閱讀(1301) 評論(0)  編輯 收藏 引用 所屬分類: Cocoa
            精品久久久久久中文字幕| .精品久久久麻豆国产精品| 99久久人妻无码精品系列| 狠狠色婷婷久久一区二区三区| 久久国产精品无码一区二区三区 | 国产呻吟久久久久久久92| 青青草原综合久久大伊人精品| 亚洲国产成人精品91久久久| 777午夜精品久久av蜜臀| 久久婷婷国产麻豆91天堂| 欧美久久久久久午夜精品| 日韩精品久久无码中文字幕 | 久久精品一区二区影院| 久久精品国产亚洲AV无码娇色| 精品国产一区二区三区久久蜜臀| AV无码久久久久不卡网站下载| 久久美女人爽女人爽| 久久久久久久91精品免费观看| 2020久久精品国产免费| 久久人人爽人人爽人人片AV东京热 | 亚洲国产一成人久久精品| 久久精品视频一| 国产真实乱对白精彩久久| 日韩av无码久久精品免费| 亚洲国产日韩欧美综合久久| 精品久久久久久99人妻| 99999久久久久久亚洲| 久久99精品国产麻豆宅宅| 女同久久| 欧美日韩精品久久久久| 国产精品日韩欧美久久综合| 99久久精品费精品国产一区二区 | 欧美午夜A∨大片久久| 国产精品久久国产精品99盘| 77777亚洲午夜久久多喷| 久久天天躁狠狠躁夜夜av浪潮| 国产精品xxxx国产喷水亚洲国产精品无码久久一区| 777午夜精品久久av蜜臀| 色婷婷综合久久久中文字幕| 久久久久久国产精品美女| 欧美精品国产综合久久|