Skip to content

Instantly share code, notes, and snippets.

@kwappa
Created May 10, 2012 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwappa/2652484 to your computer and use it in GitHub Desktop.
Save kwappa/2652484 to your computer and use it in GitHub Desktop.
コンプガチャをシミュレートしてみよう
r = Array.new(12).fill(0) ; while (r.include?(0)) do r[rand(r.count)] += 1 ; end ; puts "#{r.count}個のガチャをコンプするために #{r.inject(:+)}回抽選しました。"
@kwappa
Copy link
Author

kwappa commented May 10, 2012

@kwappa
Copy link
Author

kwappa commented May 11, 2012

countとlengthが揺れていたので統一

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment