0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rubyで誕生日攻撃の計算

Last updated at Posted at 2020-12-30

365日で23人の誕生日が衝突する可能性は50%

total = 365.0
1 - (2..23).inject((total - 1) / total) { |result, n| result * (total - n + 1) / total }
=> 0.5072972343239855
0
0
2

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?