I am working through a Pd online textbook and came across this practice problem. Every time I try to copy the patch provided I receive a "Stack Overflow" message. What am I doing wrong?

Stack Overflow Question

@b4cat you need to set random >=2 otherwise the [random] output is always 0, because of that it is not possible to ouput a result without repetition. you can avoid the stackoverflow with a [spigot] between random and trigger...

@b4cat You need to set the range for the random numbers using the number box at the top before you bang [random] to produce a number. Otherwise it just keeps sending the same number....... probably zero....... and as that is continuously rejected by [sel 1] you have a feedback loop without end....... a stack overflow.
David.
P.S..... as @Jona says....... 
Thank you both!

@b4cat This is possibly solvable within one step each time so without iteration. Say we choose a number out of four. In the first step we have four possibilities, so [random 4]. From there on we have only three possibilities, [random 3], and whenever we choose a number equal or higher than the previous, we can just add one.

@ingox i think it is solved like that in this thread (including a discussion if it is accurate ):
https://forum.pdpatchrepo.info/topic/10366/newbieperspectiveontherandomwithoutrepetitionsexercise 
Having had a look at the lengthy discussion in the thread @Jona linked, i think i should explain the idea more clearly, as my description above was not accurate.
The basis of the idea is thinking in modulo classes, so a little bit like thinking in circles, like we do with the clock.
Say we draw one out of four numbers, so we use [random 4]. After that we can only choose three numbers as the previous one should not repeat. So we use [random 3]. But we don't start at zero. We start at the previous picked number + 1 and add the random number from [random 3] (0, 1 or 2) and take this modulo four.
Examples:
We choose 2. So in the next turn we can have 3, 0 or 1.
We choose 3. So in the next turn we can have 0, 1 or 2.
We choose 1. So in the next turn we can have 2, 3 or 0.
We choose 0. So in the next turn we can have 1, 2 or 3. 
@ingox thanks, i think i understand. and i assume our examples have the same accuracy?

@Jona Yes, both examples should be equivalent. I tested my patch and it produces nearly perfectly distributed results. It is basically not a difficult idea, only the discussion in the thread was so much confusing.

@Jona Here is a slight modification to your patch: randomwithoutrepetition.pd

@ingox thanks. it is not really my patch, just used the conclusion from the thread i posted as an example.
edit: i removed the second random object again, because then it is possible to change the range without repetitions, and included an initSeed: randomwithoutrepetition.pd