What is the best way to check if implementation of density, distribution function, quantile function and random generation for some distribution are correct? For example, base R lacks [Laplace distribution][1]. Let's say we implement it. We can use random generation function and check if generated values are "similar" to density and distribution functions, but this is quite *idem per idem* kind of check. We know that if $X,Y \sim \mathrm{Exp}(\lambda)$ then $X-Y \sim \mathrm{Laplace}(0, \lambda^{-1})$, so we can generate exponential distributed values and use them to imitate Laplace distribution, however how do we know that we are close enough? We can check also if $X = F_X^{-1}(F_X(X))$, but what more? What other issues need to be checked (e.g. [underflow or overflow][2]) and what are the best practices?


  [1]: https://en.wikipedia.org/wiki/Laplace_distribution
  [2]: https://stackoverflow.com/questions/6360049/what-are-arithmetic-underflow-and-overflow-in-c