NumberInInterval
implement safe permutation
try to use typeclass IsElemType, but not successful. concluded that this approach is not valid