Add ntile window function

Maybe add a comment explaining how this works. I had to reverse-engineer it with pen and paper to figure out what it does.