隨筆-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.   回復  更多評論
            
          # 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.   回復  更多評論
            
          # 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.   回復  更多評論
            
          # 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ā)表評論。


          網(wǎng)站導航:
           
          已訪問數(shù):
          free counters
          主站蜘蛛池模板: 郯城县| 融水| 南乐县| 翼城县| 河东区| 崇阳县| 手游| 崇明县| 沙田区| 尤溪县| 珠海市| 景洪市| 吴忠市| 伊宁县| 新平| 鄂尔多斯市| 万盛区| 微博| 新竹市| 昌黎县| 海伦市| 双辽市| 客服| 天全县| 泰安市| 龙井市| 长阳| 电白县| 锡林郭勒盟| 宝应县| 彰武县| 于田县| 长丰县| 乌什县| 宿州市| 修武县| 丹棱县| 尼勒克县| 五常市| 龙海市| 保靖县|