The modulo (%) operator finds the remainder of the division of a number by another. As an example, 7 % 3 = 1, 8 % 4 = 0 and so on. index %= 49 makes sure that index can't exceed 48; it will be set to 0, 1, 2, ..., 47, 48, 0, 1, 2... as index is incremented.