View Single Post
  #3   Report Post  
hgrove
 
Posts: n/a
Default


Frank Kabel wrote...
see:
http://www.mcgimpsey.com/excel/udfs/randint.html

...

Incomplete answer. Randint could provide a shuffled array of numbers
from 1 to 16, but to sample from it cyclically would require another
UDF like

Function cycrnd() As Long
Static a As Variant, n As Long

Application.Volatile 'necessary for this

If IsEmpty(a) Then
a = randint(1, 16)
n = LBound(a)

Else
If n < UBound(a) Then n = n + 1 Else n = LBound(a)

End If

cycrnd = a(n)

End Function


--
hgrove
------------------------------------------------------------------------
hgrove's Profile: http://www.excelforum.com/member.php...o&userid=11432
View this thread: http://www.excelforum.com/showthread...hreadid=274544