<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 远游客</title>
    <description>The latest articles on DEV Community by 远游客 (@sunnyboy23).</description>
    <link>https://dev.to/sunnyboy23</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4253375%2F5163674d-5e80-4e7e-a9ea-28a63c032554.jpg</url>
      <title>DEV Community: 远游客</title>
      <link>https://dev.to/sunnyboy23</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sunnyboy23"/>
    <language>en</language>
    <item>
      <title>How to calculate the odds of pulling one card in a five-card pack</title>
      <dc:creator>远游客</dc:creator>
      <pubDate>Thu, 19 Nov 2026 08:45:23 +0000</pubDate>
      <link>https://dev.to/sunnyboy23/how-to-calculate-the-odds-of-pulling-one-card-in-a-five-card-pack-1ilk</link>
      <guid>https://dev.to/sunnyboy23/how-to-calculate-the-odds-of-pulling-one-card-in-a-five-card-pack-1ilk</guid>
      <description>&lt;p&gt;If a card has a 0.0043% chance to appear in one slot, what are the odds of seeing it at least once in a five-card pack? And how many packs would give you a 50% chance? Here is a worked example using GRIEF from Extreme Demon Gacha.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the chance of missing
&lt;/h2&gt;

&lt;p&gt;Let &lt;code&gt;p&lt;/code&gt; be the chance of drawing the target card in one slot, expressed as a decimal. Assume each slot is independent and uses the same odds. The chance that all five slots miss is &lt;code&gt;(1 - p)^5&lt;/code&gt;. Subtract it from 1 to get the chance of at least one hit:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chance per pack = &lt;code&gt;1 - (1 - p)^5&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The same idea works across any number of packs. For &lt;code&gt;n&lt;/code&gt; five-card packs, there are &lt;code&gt;5 * n&lt;/code&gt; slots, so the chance is &lt;code&gt;1 - (1 - p)^(5 * n)&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked example: GRIEF
&lt;/h2&gt;

&lt;p&gt;In Demon Index’s November 18, 2026 data snapshot, GRIEF’s per-slot rate was about &lt;strong&gt;0.00429682%&lt;/strong&gt;, or &lt;strong&gt;0.0000429682&lt;/strong&gt;. That gives about &lt;strong&gt;0.02148% per five-card pack&lt;/strong&gt;. After 100 packs, the chance of seeing at least one copy is about &lt;strong&gt;2.13%&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target chance&lt;/th&gt;
&lt;th&gt;Packs needed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;50%&lt;/td&gt;
&lt;td&gt;3,227&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;90%&lt;/td&gt;
&lt;td&gt;10,718&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;95%&lt;/td&gt;
&lt;td&gt;13,944&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At 3,227 packs, roughly half of independent runs would still end without a copy. If you only want a holo and the holo roll is an independent 10%, multiply the &lt;strong&gt;per-slot&lt;/strong&gt; rate by 0.10 before calculating the pack odds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calculate it in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;perSlot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.00004296819632637584&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;slotsPerPack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;logMissPerPack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;slotsPerPack&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log1p&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;perSlot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;chanceAfter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;packs&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expm1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;packs&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;logMissPerPack&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;packsFor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ceil&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log1p&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;logMissPerPack&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;chanceAfter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"%"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 2.13%&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;packsFor&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// [3227, 10718, 13944]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Math.log1p&lt;/code&gt; and &lt;code&gt;Math.expm1&lt;/code&gt; help preserve precision when the per-slot rate is very small. The model assumes independent, fixed-rate slots. Guaranteed slots or pity mechanics need their own model.&lt;/p&gt;

&lt;p&gt;Try a different card or pack count in the fan-made &lt;a href="https://demonindex.com/odds-calculator?card=grief-f3dd5ead" rel="noopener noreferrer"&gt;Demon Index odds calculator&lt;/a&gt;. The &lt;a href="https://demonindex.com/methodology" rel="noopener noreferrer"&gt;methodology and data sources&lt;/a&gt; explain how the tool uses the game’s published rates.&lt;/p&gt;

</description>
      <category>data</category>
      <category>science</category>
    </item>
  </channel>
</rss>
