Abstract
Sie können Zufallszahlen mit einer gewünschten Verteilung einfach erzeugen, wenn die inverse Verteilungsfunktion explizit vorliegt.
Ein Beispiel einer geschichteten Stichprobe:
Ohne die explizit vorliegende inverse Verteilungsfunktion können Sie eine lineare Approximation mit der Function sbRandPDF anwenden.
Appendix – sbRandCDFInv Code
Bitte den Haftungsausschluss im Impressum beachten.
Option Explicit
Function sbRandCDFInv(dParam1 As Double, dParam2 As Double, _
dParam3 As Double, Optional dRandom = 1#) As Double
'Source (EN): http://www.sulprobil.com/sbrandcdfinv_en/
'Source (DE): http://www.bplumhoff.de/sbrandcdfinv_de/
'(C) (P) by Bernd Plumhoff 03-Nov-2020 PB V0.2
Static bRandomized As Boolean
Dim dRand As Double
If dRandom < 0# Or dRandom > 1# Then
sbRandCDFInv = CVErr(xlErrValue)
Exit Function
End If
If Not bRandomized Then
Randomize
bRandomized = True
End If
If dRandom = 1# Then
dRand = Rnd()
Else
dRand = dRandom
End If
'Here you need to define the inverse of the cumulative distribution function
sbRandCDFInv = sbRandTriang(dParam1, dParam2, dParam3, dRand)
End Function