My code so far, first part, where I produce random numbers to the specific range:
Dim i As Long
Randomize
     For i = 1 To 20000
         Range("A" & i) = Rnd()
     Next i
      Range("A1") = ("Rand")
      ActiveCell.Range("A1:A20000").Select
    Sheets("Sheet1").Columns("A").Copy
    Sheets("Sheet1").Columns("B").PasteSpecial xlPasteValues
     Sheets("Sheet1").Columns("A").Delete
    Range("A1") = ("Rand")
      MsgBox ("Nagenerovaných 20 000 hodnôt")
In the second part I am trying to get Gamma.Inv:
  Dim alfa As Integer
  Dim beta As Integer
  Dim a As Long
  Range("I2").Value = InputBox("zadaj parameter alfa")
  Range("J2").Value = InputBox("zadaj parameter beta")
  Range("B2").Select
 Range("I2").Value = alfa
 Range("J2").Value = beta
 For a = 1 To 20000
 Range("B" & a) = WorksheetFunction.Gamma_Inv(Rnd(), alfa, beta)
 Next a
The first part of the code works fine, but it takes a while to make these random numbers. Is there a more efficient way to do this?
The second part does not work. What I am trying to do is using random number I have already generated instead of Rnd() in gamma function. I Have tried the second part of the code with the rand(), because I wanted to know, if its gonna work.
PS: it's a school project and each part of the code is started by pressing a click button, in case you are wondering why I have separated it into 2 parts.
 
     
     
    