# rcognita.utilities.rej_sampling_rvs

rcognita.utilities.rej_sampling_rvs(dim, pdf, M)

  Random variable (pseudo)-realizations via rejection sampling.

  Parameters

    - dim (: integer) – dimension of the random variable

    - pdf (: function) – desired probability density function

    - M (: number greater than 1) – it must hold that \(\text{pdf}_{\text{desired}} \le M \text{pdf}_{\text{proposal}}\). This function uses a normal pdf with zero mean and identity covariance matrix as a proposal distribution. The smaller M is, the fewer iterations to produce a sample are expected.

  Returns

  Return type

    A single realization (in general, as a vector) of the random variable with the desired probability density.