Simulation and modeling - Old Questions
7. Describe the rejection method of generating the random numbers.
Answer
AI is thinking...
The rejection method for obtaining samples of random numbers forms a given non-uniform distribution works by generating uniform random numbers repeatedly and accepting only those numbers that meet certain conditions.
The rejection method is applied when the probability density function, f(x), has a lower and upper limit to its range, 'a' and 'b', respectively, and an upper bound 'c'. The method can be specified as follows:
1. Find the maximum value c of f(x) on a ≤ x ≤ b.
f(X) ≤ c ∀ x ∈ [a, b]
2. Compute two values μ1, μ2 of the uniformity distributed variables, both defined on [a, b] = [0, 1].
3. Compute x0 = a + μ1(b - a)
4. Compute y0 = c μ2
5. If y0 ≤ f(x0), accept x0 as desired output; otherwise reject x0 and repeat the process with two next values μ1 & μ2.