Skip to content

Custom univariate sampler not working as expected #1132

@nluetts

Description

@nluetts

Implementing a univariate sampler as described in the documentation, i.e. just implementing the function

function rand(s::Spl)
    # ... generate a single sample from s
end

is not working as expected. Specifically, the documentation says:

The package already implements a vectorized version of rand! and rand that repeatedly calls the he scalar version to generate multiple samples.

So after implementing the function above, I was expecting generating several samples at once (calling rand(mysampler, 10000)) to work, but it throws an error. However, it works fine if the function rand(rng::AbstractRNG, s::Spl) is implemented.

For a full code example, see this discussion on julia discourse.

Is the documentation regarding custom samplers perhaps outdated?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions