LoginSignup
3
3

More than 5 years have passed since last update.

アルファベットからランダムで1文字取得

Posted at
$ irb                                                                                                                                                                      1.8.7 :001 > ('A'..'Z').to_a.shuffle[0]
 => "Y"
1.8.7 :002 > ('A'..'Z').to_a.shuffle[0]
 => "P"
1.8.7 :003 > ('A'..'Z').to_a.shuffle[0]
 => "W"
1.8.7 :004 > ('A'..'Z').to_a.shuffle[0]
 => "A"
1.8.7 :005 > ('A'..'Z').to_a.shuffle[0]

でいいのかしら。

3
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3