I'm not entirely sure of just what you want.
But here's a VBA code that enters your numbers randomly in Range(A1:A2529), with relative frequency according to your indicated weights. Just run it on a blank worksheet and see.
Sub random_distr()
Const n& = 2529
Dim vals, probs
Dim c As Long, j As Long
Dim s As Double, x As Double
Dim d As Object
Set d = CreateObject("scripting.dictionary")
vals = Array(-3, -2, -1, 0, 1, 2, 3)
probs = Array(0.05, 0.1, 0.2, 0.3, 0.2, 0.1, 0.05)
For c = 1 To n
s = 0: x = Rnd
For j = 0 To UBound(probs)
s = s + probs(j)
If x <= s Then
Cells(c, "a") = vals(j)
d(vals(j)) = d(vals(j)) + 1
Exit For
End If
Next j, c
[c1].Resize(, 3) = Array("Number", "Count", "Frequency")
With [c2].Resize(d.Count, 2)
.Value = Application.Transpose(Array(d.keys, d.items))
.Sort [c2], 1, Header:=xlNo
End With
With [d2].Resize(d.Count)
.Offset(, 1) = Evaluate(.Address & "/" & n)
.Offset(, 1).NumberFormat = "0.00"
End With
End Sub
Bookmarks