I'm getting ONE in Monte Carlo simulation, I increased the number of simulations till 1e8, but still ones I`m trying to obtain the probability of failure. Here is my code Inputs are the mean and standard deviation and the type of distribution of the three parameters shown in function z. Here is the Code in R-studio
#MCcrude<-function(M,S,P=NULL,DS=NULL,Nsm,Nrp){
Nvr=length(M)
pf=NULL
for(k1 in seq(1:Nrp)){
X=NULL
for(j1 in seq(1,Nvr)){
X=cbind(X,rnorm(Nsm,mean= M[j1],sd =S[j1]))
}
z=30*X[,2]*X[,1]-X[,2]X[,1]^2-30X[,3]*X[,1]-X[,3]*X[,1]
pf=rbind(pf,length(which(z<=0))/Nsm) #probability of failure
}
return(pf)
}#