• <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://m.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
            国产成人无码久久久精品一| 精品水蜜桃久久久久久久| 久久精品无码一区二区三区日韩| 久久久久夜夜夜精品国产| 久久精品国产秦先生| 久久亚洲国产精品123区| 亚洲AV无码1区2区久久| 99久久777色| 四虎影视久久久免费| 精品久久久久香蕉网| 久久久久亚洲av毛片大| 日本欧美久久久久免费播放网| 日韩亚洲欧美久久久www综合网| 亚洲国产成人久久综合碰| 99久久国语露脸精品国产| 怡红院日本一道日本久久| 久久亚洲精品无码aⅴ大香| 精品久久久无码中文字幕| 国产精品美女久久福利网站| 久久精品国产亚洲av麻豆色欲 | 日韩中文久久| www.久久热.com| 国产成人精品综合久久久| 久久国产免费| 品成人欧美大片久久国产欧美| 99精品国产99久久久久久97| 人妻少妇精品久久| 99久久精品费精品国产| 国产精品美女久久久久| 青草国产精品久久久久久| 久久受www免费人成_看片中文| 国产一区二区精品久久岳| 91精品国产综合久久香蕉| 久久偷看各类wc女厕嘘嘘| 久久国产劲爆AV内射—百度| 久久人人爽人人爽人人片AV麻豆 | 四虎国产精品成人免费久久| 久久99精品久久久久久水蜜桃| 国产情侣久久久久aⅴ免费| 亚洲AV乱码久久精品蜜桃| 国产99久久久国产精品小说|