generate ranges for loops