generate a sequence of random numbers

  • Thread starter Thread starter Grimwadec
  • Start date Start date
G

Grimwadec

For doing golf draws I wish to create a vba function that will generate all
the numbers in a given range in random order, e.g. say 5 players with a
resultant random order of 4,1,5,3,2

The following only gives me one number at a time
Function GenNumbers()

Dim RandomInt

Randomize

RandomInt = Int(((20 - 1 + 1) * Rnd) + 1)

Result = RandomInt

End Function

and the following only gives the numbers in terms of Rnd function

Function LoopGenNumbers()

Dim sngR As Single
Randomize

For A = 1 To 10
sngR = Rnd()

Debug.Print sngR * Rnd()
Next A

End Function

Help please
 
Back
Top