By its logic, if all three values are drawn equal (eg 42
, 42
, 42
) then it will never leave the loop:
-
cap_inicial_1 <= cap_inicial_2
? Yes: 42 <= 42
. Enter the loop;
-
cap_inicial_1 < cap_inicial_2
? No: 42 == 42
. It does not change anything;
-
cap_inicial_2 < cap_inicial_3
? No: 42 == 42
. It does not change anything;
- Return to the beginning of the loop, without changing any of the values: repeat the same as it occurred, infinitely ...
As the numbers are random, some seeds will give values of this type, others do not. There is nothing to do but rethink your logic. I can not make a suggestion because I do not know what this code should do. But the problem is identified.
P.S. Since the condition of your while
uses or
instead of and
, many other combinations of numbers could lead to this same result. For example, 50
, 20
, 20
...