Monte Carlo Method, Random Number Generator, Importance Sampling, Reversetransformsampling, Rejection Sampling.
random_samples print("generating...") random_samples = rejection_generator(n=50) print("n_sample = ",len(random_samples)) plt.scatter(random_samples,[0]*len(random_samples),marker='x') xx=np.linspace(-15,15,1000) plt.plot(xx,[p_laplace(i) for i in xx],c='red') plt.legend(['true','gen']) plt.show()