• <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
            国产精品免费久久久久电影网| 久久99热这里只有精品国产| 91久久婷婷国产综合精品青草 | 色诱久久久久综合网ywww| 色综合久久久久无码专区| 国产精品99久久不卡| 亚洲欧美一级久久精品| 精品免费tv久久久久久久| 亚洲国产成人精品久久久国产成人一区二区三区综 | 狠狠综合久久综合88亚洲| 四虎国产永久免费久久| 国产成人久久精品一区二区三区 | 一本大道久久a久久精品综合| 内射无码专区久久亚洲| 大美女久久久久久j久久| 久久久久99这里有精品10 | 久久精品18| 伊人久久大香线蕉精品| 国产精品久久久久久久久久影院 | 久久人人爽人人爽人人片AV麻烦| 性欧美丰满熟妇XXXX性久久久| 久久精品亚洲福利| 国产99久久久国产精品~~牛| 亚洲AV日韩AV永久无码久久| 手机看片久久高清国产日韩| 国产成人久久777777| 欧美一区二区精品久久| 996久久国产精品线观看| 亚洲国产精品成人久久| 亚洲AV无码久久| 久久亚洲AV成人无码电影| 天天爽天天狠久久久综合麻豆 | 久久久久久久97| 72种姿势欧美久久久久大黄蕉| 久久人人爽人人人人爽AV| 久久精品国产清自在天天线| 国产精品免费久久| 久久伊人五月天论坛| 久久午夜无码鲁丝片秋霞 | 久久国产精品99久久久久久老狼| 色综合久久综合中文综合网|