Quote Originally Posted by cafeenman View Post
Code:
Public Enum SHUFFLE_TYPE_INDEX

  idx_ShuffleType_EquipRandom = 1  ' 1 Equip Random Items.
  idx_ShuffleType_EquipBest        ' 2 Prioritize Highest Level Items.
  idx_ShuffleType_EquipWorst       ' 3 Prioritize Lowest Level Item.
  idx_ShuffleType_BackpackPriority ' 4 Prioritize Backpack Items.
  idx_ShuffleType_EquippedPriority ' 5 Prioritize Equipped Items.
  idx_ShuffleType_UnequipAll       ' 6 Store All Items (go naked).

End Enum

Public Const MIN_SHUFFLE_TYPE_INDEX As Long = idx_ShuffleType_EquipRandom
Public Const MAX_SHUFFLE_TYPE_INDEX As Long = idx_ShuffleType_UnequipAll

Sub SomeSub
dim nShuffleType as SHUFFLE_TYPE_INDEX

nShuffleType = RollDie(MAX_SHUFFLE_TYPE_INDEX )

End Sub
Oh I understand now. ShuffleType is not actually a bit field. You just want to simplify the comparisons. Well you can do this using primes if you wanted to:-
Code:
Public Enum SHUFFLE_TYPE_INDEX

  idx_ShuffleType_EquipRandom = 2  ' 1 Equip Random Items.
  idx_ShuffleType_EquipBest = 3      ' 2 Prioritize Highest Level Items.
  idx_ShuffleType_EquipWorst = 5     ' 3 Prioritize Lowest Level Item.
  idx_ShuffleType_BackpackPriority = 7 ' 4 Prioritize Backpack Items.
  idx_ShuffleType_EquippedPriority = 11 ' 5 Prioritize Equipped Items.
  idx_ShuffleType_UnequipAll = 13     ' 6 Store All Items (go naked).

End Enum

Private Sub Form_Load()
    Dim st(0 To 5) As SHUFFLE_TYPE_INDEX
    
    st(0) = idx_ShuffleType_EquipRandom
    st(1) = idx_ShuffleType_EquipBest
    st(2) = idx_ShuffleType_EquipWorst
    st(3) = idx_ShuffleType_BackpackPriority
    st(4) = idx_ShuffleType_EquippedPriority
    st(5) = idx_ShuffleType_UnequipAll
    
    For i = LBound(st) To UBound(st)
        'Filter out all options that are not the best and not the worst
        If (idx_ShuffleType_EquipBest * idx_ShuffleType_EquipWorst) Mod st(i) Then Debug.Print st(i) & " : " & "Exit Function"
    Next
    
End Sub
The only caveat here is that you must use prime numbers for the enum values in order for this to work.