For problem 4.2, you are required to write a function which
takes as input an array of pmf values and n, and returns an
RV with the correct distribution. In Matlab, your function
could look something like:
function rv = myrfun( p, n )
% To compute discrete rv with pmf p(1), p(2), ..., p(n)
...
rv = ...
% end myrfun
You should hand in a listing for the function, along with
some test results, which show the function works for at
least one example with n = 5. The test results should include
results from a test run which generates at least N=10000 RVs
and compares the output proportions with the input pmf values.