Monte Carlo Method, Random Number Generator, Importance Sampling, Reversetransformsampling, Rejection Sampling.
# Laplace distribution variance calculation N = [] P = [] n= 10 while n <= 100000: theta = rejection_generator(n) p = 0 for x in theta: p += x*x N.append(n) P.append(p/n) n = n*2 P_r = [2]*len(N) plt.plot(N,P) plt.plot(N,P_r,c='red') plt.legend(["Rejection Sampling value","true value(2)"])