int[] r = new int[1000];
ExponentialDistribution exp = new ExponentialDistribution(4.0);
for(int i = 1; i <r.length; i++){
r[i] = (int)exp.sample() + 1 + r[i-1];
}
The above code fills array [r] from r[0] = 0 to r[999] = 4527. This is the result of one random run. If r.length is increased to 2000, the last element r[1999] increases 8963. I am trying to find the solution to fill the array [r] within range 0 - 5000. Even if r.length is increased, the array should be filled in this range exponentially.Say in this case, if r[999] <= 5000, then r[1999] should also be <=5000.
Say, r.length represents total no. of events and each element of array r represents the time at which event occurs.Total time is 5000 units. Motive is that first event happens at time 0 and last at time <=5000 even if r.length is increased or decreased that is inter occurrence time of two events should be adjusted accordingly.
Thanks a lot