Ruby case

生成随机字符串 0.1

#!/usr/bin/ruby

def apass(n)
    chars=(0..9).to_a+("a".."z").to_a+("A".."Z").to_a
    1.upto(n){print chars[rand(chars.size)]}
end

puts apass(10)
/var/lib/openshift/bccd8eac1968476490eaee9ced33c7bf/app-root/runtime/repo/php/data/pages/myruby.txt · 最后更改: 2012/09/07 09:21 (外部编辑)
到顶部
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0