# Function of an irregular zigzag line

First time questioner on the maths site, so thanks in advance to anyone kind enough to help me out. For context, I'm an author and I'm trying to find an accurate way for an AI character to refer to an irregular zigzag line. In so doing I run the risk of the query being less relevant to other netizens, but in my initial research I was able to find a formula for a regular zigzag line: y = acos(cos(x)). If this function is deemed interesting enough for a youtube video, I can only hope that the function for an irregular line is at least as interesting.

So, there's not much more to the question than that. Would anyone be able to tell me how to write a function for an irregular zigzag line please? The precise details of the zigzag line, the comparative lengths of the zigs and zags and the angles between them, can all be random. Basically, the AI character is being very AI in its description of a queue of humans, as it tries to resolve their random orientation to one another with its understanding of the definition of a queue as a line of people.

Again, thanks in advance to anyone who can help me out with this.