Created
October 7, 2011 09:42
-
-
Save tatsuosakurai/1269914 to your computer and use it in GitHub Desktop.
9桁の数字を求める
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 | |
(rand(900000000)+10 ** 9).to_s | |
# 2 | |
([(0..9).to_a]*9).map{|i|i.sample}.join | |
# 3 | |
sprintf("%09d", rand(10 ** 9)) | |
# 4 | |
Array.new(9){ Array(0..9).sample }.join | |
# 5 | |
9.times.map{rand 10}.join | |
# 6 | |
"#{rand(10 ** 9)}".rjust(9, '0') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment