Same as variance explanation, since std = sqrt(variance):
When calculation variance we can divide the calculation by N, or by N-1.
When calculating sample variance we divide by N-1 (like in the current code).(https://towardsdatascience.com/why-sample-variance-is-divided-by-n-1-89821b83ef6d)
Sometimes We want to divide by N like the basis formula, to calculate population variance. (https://en.wikipedia.org/wiki/Variance#Discrete_random_variable)
For me its useful to add another parameter that will make it possible to calculate both of then using one function.
Is it useful for you?