Abstract

Wenn Sie simulieren wollen, wie Partikel ausgehend von einem festen Punkt auf eine Gerade treffen, können Sie eine Cauchy Verteilung verwenden. Diese Verteilung wird manchmal auch Lorentz Verteilung genannt. Auch der Quotient zweier (0,1) Normalverteilungen führt zu einer Cauchy Verteilung.

sbRandCauchy

Appendix – Programmcode sbRandCauchy

Bitte den Haftungsausschluss im Impressum beachten.

Option Explicit

Const GCPi = 3.14159265358979

Function sbRandCauchy(dLocation As Double, dScale As Double, _
    Optional dRandom = 1#) As Double
'Source (EN): https://www.sulprobil.com/sbrandcauchy_en/
'Source (DE): https://www.bplumhoff.de/sbrandcauchy_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# Or dScale <= 0# Then
    sbRandCauchy = 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
sbRandCauchy = dLocation + dScale * Tan((dRand - 0.5) * GCPi)
End Function