<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Distribution With Explicit Inverse Cumulative Distribution Function on Sulprobil</title>
    <link>https://www.sulprobil.de/tags/distribution-with-explicit-inverse-cumulative-distribution-function/</link>
    <description>Recent content in Distribution With Explicit Inverse Cumulative Distribution Function on Sulprobil</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 14 Jul 2026 16:11:00 +0100</lastBuildDate>
    <atom:link href="https://www.sulprobil.de/tags/distribution-with-explicit-inverse-cumulative-distribution-function/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>sbRandCDFInv (VBA)</title>
      <link>https://www.sulprobil.de/sbrandcdfinv_en/</link>
      <pubDate>Tue, 14 Jul 2026 16:11:00 +0100</pubDate>
      <guid>https://www.sulprobil.de/sbrandcdfinv_en/</guid>
      <description>&lt;h2 id=&#34;abstract&#34;&gt;Abstract&lt;/h2&gt;&#xA;&lt;p&gt;You can create random numbers with a given distribution easily if you have an&#xA;explicit form of the inverse of the cumulative distribution function.&lt;/p&gt;&#xA;&lt;p&gt;A stratified sample:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://www.sulprobil.de/Triang_stratified_sample.png&#34; alt=&#34;Triang_stratified_sample&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;If there is no explicit form of a cumulative distribution function inverse then you can&#xA;apply a linear approximation with the probability distribution function &lt;a href=&#34;https://www.sulprobil.de/sbrandpdf_en/&#34; title=&#34;sbRandPDF&#34;&gt;sbRandPDF&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;appendix--sbrandcdfinv-code&#34;&gt;Appendix – sbRandCDFInv Code&lt;/h2&gt;&#xA;&lt;p&gt;Please read my &lt;a href=&#34;https://www.sulprobil.de/about/disclaimer_en/&#34; title=&#34;Disclaimer&#34;&gt;Disclaimer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-VB.net&#34; data-lang=&#34;VB.net&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;Option&lt;/span&gt; Explicit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;Function&lt;/span&gt; sbRandCDFInv(dParam1 &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Double&lt;/span&gt;, dParam2 &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Double&lt;/span&gt;, _&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    dParam3 &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Double&lt;/span&gt;, &lt;span style=&#34;color:#00f&#34;&gt;Optional&lt;/span&gt; dRandom = 1#) &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Double&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&amp;#39;Source (EN): https://www.sulprobil.de/sbrandcdfinv_en/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&amp;#39;Source (DE): https://www.berndplumhoff.de/sbrandcdfinv_de/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&amp;#39;(C) (P) by Bernd Plumhoff  03-Nov-2020 PB V0.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#00f&#34;&gt;Static&lt;/span&gt; bRandomized &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Boolean&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;Dim&lt;/span&gt; dRand &lt;span style=&#34;color:#00f&#34;&gt;As&lt;/span&gt; &lt;span style=&#34;color:#2b91af&#34;&gt;Double&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt; dRandom &amp;lt; 0# &lt;span style=&#34;color:#00f&#34;&gt;Or&lt;/span&gt; dRandom &amp;gt; 1# &lt;span style=&#34;color:#00f&#34;&gt;Then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sbRandCDFInv = CVErr(xlErrValue)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#00f&#34;&gt;Exit&lt;/span&gt; &lt;span style=&#34;color:#00f&#34;&gt;Function&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;End &lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt; &lt;span style=&#34;color:#00f&#34;&gt;Not&lt;/span&gt; bRandomized &lt;span style=&#34;color:#00f&#34;&gt;Then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Randomize&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bRandomized = &lt;span style=&#34;color:#00f&#34;&gt;True&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;End&lt;/span&gt; &lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt; dRandom = 1# &lt;span style=&#34;color:#00f&#34;&gt;Then&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    dRand = Rnd()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;Else&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    dRand = dRandom&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;End&lt;/span&gt; &lt;span style=&#34;color:#00f&#34;&gt;If&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&amp;#39;Here you need to define the inverse of the cumulative distribution function&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#008000&#34;&gt;&lt;/span&gt;sbRandCDFInv = sbRandTriang(dParam1, dParam2, dParam3, dRand)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#00f&#34;&gt;End&lt;/span&gt; &lt;span style=&#34;color:#00f&#34;&gt;Function&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: A comprehensive documentation of my Excel implementations can be found in&#xA;&lt;a href=&#34;https://www.sulprobil.de/excel_vba_a_collection_en/&#34; title=&#34;Excel VBA A Collection&#34;&gt;Excel VBA A Collection&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
