add checking of numeric indices to an array to see if they can reasonably be considered integers. Avoid undefined behaviour if out of bounds
convert range bounds to integers in a way that avoids undefined behaviour