Third central and non-central moment in LO

Where can I find this “Standard Basic Library” and everything what’s in it ? How do I move Code to the Standard Library ? I new to LibreOffice still and I do not know even what module is !

Have you typed everything what I copy below OR is that on the other hand somehow generated automatically ?

REM ***** BASIC *****

Function centralNormalizedMoment(pSequence, pOrder, Optional pIsSample As Boolean) As Double
If IsMissing(pIsSample) Then pIsSample = True
fa = CreateUnoService(“com.sun.star.sheet.FunctionAccess”)
N = Ubound(pSequence)
mu = fa.callFunction(“AVERAGE”, Array(pSequence))
useVar = fa.callFunction(“VARP”, Array(pSequence)) * IIf(pIsSample, N/(N - 1), 1)
useSD = Sqr(useVar)
nFactor = 1 / useSD
For j = 1 To N
pSequence(j, 1) = ((pSequence(j, 1) - mu)*nFactor)^pOrder
Next j
prelim = fa.callFunction(“AVERAGE”, Array(pSequence))
If pIsSample Then
For k = 1 To pOrder - 1
prelim = prelim * N / (N-k)
Next k
End If
centralNormalizedMoment = prelim
End Function

Function generalNormalizedMoment(pSequence, pOrder, pFocus, Optional pIsSample As Boolean)
REM No responsibility taken!

I’m the author of the code. However, I use pieces of older code or from my toolbox wherever it seems appropriate. There isn’t a thing like an “autonmatic generator” for the kind of code.
Anyway I don’t want to enforce any claims. To the contrary I want to disclaim any reliabilty for a mess somebody may make using code he didn’t understand, and therefore couldn’t check for correctness and for possible constraints concerning its usage.