[Originally posted by TeeGee]

I'v been programming in VB for seven days now and came to a problem. I need to find a better function for permutating. it's called with elements in range 2-10 and run the testp(blah) function for every permutation.. you got a faster

Public Function permc(ByRef elements As Byte, perms() As Byte)

If elements = 2 Then
Call testp(perms())
table(0) = table(1) 'index 0 is just
table(1) = table(2) 'for swiching
table(2) = table(0) 'elements
Call testp(perms())
table(0) = table(1)
table(1) = table(2)
table(2) = table(0)
For Counter = 1 To elements
table(0) = perms(elements)
table(elements) = table(Counter)
table(Counter) = table(0)
Call permc(elements - 1,perms())
table(0) = table(elements)
table(elements) = table(Counter)
table(Counter) = table(0)
End If
end function