For the following simple while loop, once in every 5 runs, I get a list of wrong values for x, as if the values jump suddenly:
package test;
public class test_old {
public static void main(String [] args) {
    double r0 = 0.1;
    double r = 10; 
    double k = 0.05; 
    double x = 0; 
    double Tt = 0;
    double T = 0;
    while (Tt<=30) {
        double xi = Math.random();
        T = Math.log(1/xi)/(k*x + r0 + r);
        Tt = Tt + T;
        x = x + 1;
        System.out.println(x);
    }   
}
}
Instead of getting 1.0, 2.0, 3.0, .. etc (usually around 4 values until Tt is bigger than 30), I sometimes get a list of x values that seems to go on for ever starting at for example 89462.0, or 19945.0. The list of x values is correctly incremented by 1, but it never stops. I am a beginner using Eclipse. Thank you everyone for your time!
 
     
     
    