You can create random numbers with a given distribution easily if you have an explicit form of the inverse of the cumulative distribution function:
Please read my Disclaimer.
Function sbRandCDFInv(dParam1 As Double, dParam2 As Double, _
dParam3 As Double, Optional dRandom = 1#) As Double
'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
bRandomized = True
End If
If dRandom = 1# Then
dRand = Rnd()
dRand = dRandom
End If
'Here you need to define the inverse of the cumulative distribution function
sbRandCDFInv = sbRandTriang(dParam1, dParam2, dParam3, dRand)
End Function
This function will provide with a stratified sample:
Other examples would be sbRandCauchy or sbRandTriang directly.
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.
Copy link