ich habe ein Problem ich habe vier Zahlen z.B. 50, 254, 219 und 311 und möchte diese vier Zahlen mit einer prozentualen Häufigkeit von 23%, 10%, 53% und 12% zufällig in eine Spalte schreiben! Könnt Ihr mir vielleicht helfen?
Sub ZufallsVerteilung()
Const cintAnzahl As Integer = 99 '1 kleiner als Bedarf (Start bei 0)
Dim arrWerte() As String
Dim i%, intZufall%
'100 Werte
ReDim arrWerte(cintAnzahl)
For i = 0 To cintAnzahl
Select Case i
Case 0.33 * cintAnzahl To 0.86 * cintAnzahl: '53%
arrWerte(i) = 219
Case 0.23 * cintAnzahl To 0.33 * cintAnzahl: '10%
arrWerte(i) = 254
Case 0.86 * cintAnzahl To 0.98 * cintAnzahl: '12%
arrWerte(i) = 311
Case 0 To 0.23 * cintAnzahl: '23%
arrWerte(i) = 50
End Select
Next i
Randomize
For i = 0 To cintAnzahl
intZufall = Int((cintAnzahl - i + 1) * Rnd)
Cells(i + 1, 1).Value = arrWerte(intZufall)
arrWerte(intZufall) = arrWerte(cintAnzahl - i)
Next i
End Sub