I was curious so I did one.
Sub NDArray()
Dim arr() As Double
a = InputBox("Number of numbers")
ReDim arr(a - 1) As Double
With Application.WorksheetFunction
'fill the array with random numbers that fit a normal dist
For i = 0 To a - 1
'"A/100" is the target mean and "A/200" is target Std. Dev, change to your desire
arr(i) = .Norm_Inv(.RandBetween(1, 1000) / 10000, a / 100, a / 200)
Next i
'change the numbers to percentage of whole and multiply by 100 to get the values to sum to 100
x = .Sum(arr)
For i = 0 To a - 1
arr(i) = (arr(i) / x) * 100
Next i
'post the numbers in Column A on the active sheet
ActiveSheet.Range("A:A").ClearContents
ActiveSheet.Range("A1").Resize(a).Value = .Transpose(arr)
End With
End Sub
0
solved Create array with a normal distribution