The Random node will output the random value that is between 0 to 1. The initial i value should be zero. So for the first iteration, the comparator should output a signal TRUE to let the loop iterate again. When i is 2, the loop will stop, because the random variable is smaller than 2.
So as my thinking, the loop should iterate only two times and then stop, but the answer shown to says me the loop should iterate just 1 time. Is the answer wrong or is my thinking wrong?
I ran the same code and got 2 executions of the loop, as you'd expect.
Furthermore, since the random number generator cannot return exactly 1, the code is guaranteed to take exactly 2 loop cycles.