• <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
            久久嫩草影院免费看夜色| 97久久精品国产精品青草| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 久久国产免费直播| 久久精品99久久香蕉国产色戒| 潮喷大喷水系列无码久久精品| 久久国产精品一区| 久久精品国产亚洲AV香蕉| 久久精品成人影院| 久久午夜羞羞影院免费观看| 精品久久久久久无码人妻热| 日韩精品久久久久久久电影蜜臀| 91久久精品国产成人久久| 久久99国产精品久久99小说 | 99久久国产免费福利| 欧美日韩精品久久久免费观看| 久久九九全国免费| 人妻少妇久久中文字幕| 久久精品国产精品亚洲人人| AV狠狠色丁香婷婷综合久久 | 人妻少妇精品久久| 久久精品免费观看| 色综合久久无码五十路人妻 | 国产69精品久久久久777| 久久中文字幕人妻熟av女| 久久九九久精品国产| 久久精品男人影院| 国内精品久久国产大陆| 国产A级毛片久久久精品毛片| 亚洲午夜无码久久久久小说| 国产L精品国产亚洲区久久| 久久精品视频免费| 91久久精品91久久性色| 狠狠色婷婷久久一区二区三区| 综合久久精品色| 久久人人爽人人爽人人片AV东京热| 久久综合九色欧美综合狠狠 | 国产aⅴ激情无码久久| 久久精品国产亚洲αv忘忧草| 久久久久久久久波多野高潮| 久久精品国产亚洲av麻豆图片|