rejection_sample Function

public function rejection_sample(tdist, n, xmin, xmax) result(rst)

Uses rejection sampling to randomly sample a target distribution.

Arguments

Type IntentOptional Attributes Name
class(distribution), intent(in) :: tdist

The distribution to sample

integer(kind=int32), intent(in) :: n

The number of samples to make.

real(kind=real64), intent(in) :: xmin

The minimum range to explore.

real(kind=real64), intent(in) :: xmax

The maximum range to explore.

Return Value real(kind=real64), allocatable, dimension(:)

An N-element array containing the N samples from the distribution.


Contents