Open
Description
For components that do not fail after a maximal number of time steps function returns zero as a time of failure. This happens for small p values. This can be fixed by setting the initial value in the array to maximal number of time steps (100) and checking for this number in the loop.
function simulate(N, p, max_steps=100)
v = fill(max_steps, N, N)
t = 0
while any( v .== max_steps ) && t < max_steps
t += 1
for i= 1:N, j=1:N
if rand() < p && v[i,j]==max_steps
v[i,j] = t
end
end
end
return v
end
Metadata
Metadata
Assignees
Labels
No labels