generate a sequence of random numbers

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top