Abstract

You can create random numbers with a given distribution easily if you have an explicit form of the inverse of the cumulative distribution function.

A stratified sample:

Triang_stratified_sample

If there is no explicit form of a cumulative distribution function inverse then you can apply a linear approximation with the probability distribution function sbRandPDF

Appendix – sbRandCDFInv Code

Please read my Disclaimer.

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