Monte Carlo Method, Random Number Generator, Importance Sampling, Reversetransformsampling, Rejection Sampling.
generator def rejection_generator(n): xx = np.linspace(0,1,100) K = max(p_laplace(xx)/p_proxy(xx))+1 random_samples = [] while len(random_samples) < n: proposal = np.random.randn() v = np.random.uniform(0,K) if v <= (p_laplace(proposal)/p_proxy(proposal)): random_samples.append(proposal) return