Personally, I would suggest to simply use it in an expression as a function (outside of a plugin) is a bit cumbersome to work with.
Here is an example of doing this in that tile type selection I mentioned earlier:
So there it is. It's nothing huge, major, or grand, but it's a cute little trick that I thought might help someone out some day, so here it is.
Edit: I forgot to mention that if your range is not 0-bound (e.g. 0~9 as opposed to 1~10 or 10~20), then you'll need to add the offset at the beginning (or end) of the expression as such:
OFFSET + (abs(-TOTAL - (CURRENT + DIRECTION)) % TOTAL)
OFFSET in the cases referenced above would be 1 and 10 respectively.