keras/src/legacy/preprocessing/image.py/Iterator/_set_index_array
class Iterator:    def _set_index_array(self):
        self.index_array = np.arange(self.n)
        if self.shuffle:
            self.index_array = np.random.permutation(self.n)