creates a new array with given range