This function returns the remainder of the division firstArgument/secondArgument. It’s like the modulo (%) operator, but works for float numbers as well. Actually, the modulo operator also works with floats in Unity - these two alternatives print the same result:

print(Mathf.Repeat(2.45, 2.0).ToString("F2")); // prints 0.45
print((2.45 % 2.0).ToString("F2")); // also prints 0.45

Two of the most frequent uses of Mathf.Repeat or % in Unity are:

1- Keep angles in the 0…360 range for eulerAngles or localEulerAngles (an angle 375 becomes 15, which is the same thing):

Simple example is an angle: If you want to make sure your angle is always between 0…360 (because your algorithm required it), but your input value can be anything (because the user can input anything), you can use it. For example, -100 and 260 and 620 all represent the same angle, which is 260. This will map your arbitrary value back to the 0…360 interval:

actualAngle=Mathf.Repeat(inputAngle,360);

Note that this is a nice convenience function, but if you need to evaluate it several thousand times per frame for some reason, you will be much faster implementing it by hand:

EDIT2: somehow I missed that (int) will not handle negative values correctly. So when using that optimization, you’d need to catch that case (which will still be much faster than Mathf.Repeat() or using Mathf.Floor()):

Mathf.Repeat(253.22f, 250f) = 3.22f // You can fit one 250 in 253.22f, and the rest is 3.22f
Mathf.Repeat(503.22f, 250f) = 3.22f // You can fit two 250 in 503.22f, and the rest is 3.22f

You can use it to get the proper Euler angle, ‘Mathf.Repeat(someAngle, 360.0f);’.
If ‘someAngle’ is 362, it will return 2. (And you know that when it comes to Euler angles, 362 is same as 2)