title: Finding the distribution through random number generation in R
body: <p><code>X</code> is exponentially distributed with parameter <code>lambda=0.5</code>.<br>
  I want to find <code>Pr(1/mean(X)&lt; K)=0.95</code>
  As I don't know the distribution of <code>1/mean(X)</code> I generate a distribution by the following code.  </p>
  
  <pre><code>m&lt;-c()
  exponentialFunc&lt;-function(n,lambda,nsim){
      for(i in seq(nsim)){
      x&lt;-rexp(n,lambda)
      y&lt;-mean(x)
      m&lt;-c(m,1/y)
      }
      m
  
  }   
  </code></pre>
  
  <p>Now <code>m</code> is the distribution of <code>1/mean(x)</code>.<br>
  Now I called this function by <code>exponentialFunc(10,0.5,10000)</code> and it gives a series of values for m.<br>
  But then as I want to find the quantile of this distribution which has a probability of 0.95 when I used <code>quantile(m,0.95)</code> the output is   </p>
  
  <p><code>&gt; quantile(m,0.95)
  95% 
   NA</code><br>
  Why does it produces <code>NA</code>? Is there anything wrong in my code?</p>