隨筆-167  評論-65  文章-0  trackbacks-0

          1,rand(999999) 生成 6 位隨機數(shù)

          2,puts rand(0xffffff) # 十六進制的

          3,puts rand 生成 0-1 之間的任意數(shù)

          4,  def newpass( len )
          chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
          newpass = ""
          1.upto(len) { |i| newpass << chars[rand(chars.size-1)] }
          return newpass
          end

          puts   newpass(15)

          ref:
          http://snippets.dzone.com/posts/show/491
          http://stackoverflow.com/questions/88311/how-best-to-generate-a-random-string-in-ruby



          write by feng
          posted on 2009-03-27 19:13 fl1429 閱讀(8311) 評論(5)  編輯  收藏

          評論:
          # re: ruby 生成隨機數(shù) 和 隨機字符串 2010-01-02 04:32 | poCHLOE
          Very often different persons make the efforts to search for just some idea about <a href="http://bestwritingservice.com/buy-essay1.html">buy essay</a>. And I would offer to utilize the help of <a href="http://www.bestwritingservice.com">writing services</a>. At the same time, this is real to use some stuff from the this topic topic.   回復(fù)  更多評論
            
          # re: ruby 生成隨機數(shù) 和 隨機字符串 2010-03-31 10:58 | article submit
          This would be really simply to add the hot topic about this good post with support of article submission, but some time customers select free article submission. Hence I don’t get know what should be best of all.   回復(fù)  更多評論
            
          # re: ruby 生成隨機數(shù) 和 隨機字符串 2010-10-21 14:56 | dissertation
          I do guess that this is viable to go to this web page, because only here we should notice the nice topic related to this post. Thence, the dissertation writing service will take that for thesis sample writing.   回復(fù)  更多評論
            
          # re: ruby 生成隨機數(shù) 和 隨機字符串 2010-11-06 11:00 | dissertation
          One writes a persuasive thesis in formation to actualize a grandiose slice of academic education, such as in expectation to receive a master's degree. But there are people who provide custom dissertation, it’s better way.  回復(fù)  更多評論
            

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          已訪問數(shù):
          free counters
          主站蜘蛛池模板: 苍溪县| 沙湾县| 绥滨县| 拜城县| 枝江市| 包头市| 衡南县| 科尔| 浠水县| 阿拉尔市| 庆安县| 商洛市| 巴马| 棋牌| 香港 | 侯马市| 礼泉县| 松桃| 奇台县| 商南县| 西青区| 神池县| 且末县| 道孚县| 海南省| 武城县| 朝阳市| 拉萨市| 汝阳县| 沙田区| 湖口县| 伊吾县| 武穴市| 福海县| 清丰县| 灵山县| 安西县| 宁蒗| 中超| 汾西县| 尚义县|