Function selectFrom(ByVal anArray As Variant, Optional selectCount As Long) As Variant
Dim i As Long, Size As Long, randIndex As Long, temp As Variant
Size = UBound(anArray)
If selectCount < 1 Then selectCount = Size
For i = 1 To selectCount
randIndex = 1 + Int(Rnd() * Size)
temp = anArray(i)
anArray(i) = anArray(randIndex)
anArray(randIndex) = temp
Next i
ReDim Preserve anArray(1 To selectCount)
selectFrom = anArray
End Function