In this case the length is an arbitrary number I chose for simplicity. Usually the length of your dataset would give you the number of samples in it. Since 100 iterations are very few for a Network to train you could either use much more epochs or artificially increase the number of iterations per epoch (as I did).
To clarify:
Your dataset only contains  max_int - min_int number of samples (one for each number between them). If the index is greater than this number of samples it will be mapped down to the range using the modulo operator:
true_index = index % len(self.data)
        data = self.data[true_index]

If you have 100 samples of data (meaning indices 0-99) and you would try to index sample 100 (which would be a valid operation since it is inside the range defined by your dataset’s length) you would usually get an index which is out of bound for your data. To prevent this, the modulo operator maps it down. Index 100 % 100 (which is the number of your data samples) would equal a real index of 0, Index 101 would equal a real index of 1 etc.
I hope this helps.
Let me know if there are other questions.