Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/PoissonRandom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ rand(rng::PassthroughRNG) = Random.rand()
randexp(rng::PassthroughRNG) = Random.randexp()
randn(rng::PassthroughRNG) = Random.randn()
Comment on lines 12 to 13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since they are not imported, I assume one needs

Suggested change
randexp(rng::PassthroughRNG) = Random.randexp()
randn(rng::PassthroughRNG) = Random.randn()
Random.randexp(rng::PassthroughRNG) = Random.randexp()
Random.randn(rng::PassthroughRNG) = Random.randn()

(and the line above which I can't comment on) since otherwise calls of randexp etc. below for other RNGs than PassthroughRNG will fail.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these should just be internal wrappers with a slightly different name? Like _rand, _randexp, etc? That would make clear these aren't meant to be public dispatches of Random.rand and such?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the simplest would be to just define Random.rand, Random.randexp, and Random.randn for PassthroughRNG. For all other RNGs, the code will work automatically, without having to go through some internal function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#57


rand(rng::AbstractRNG) = Random.rand(rng)
randexp(rng::AbstractRNG) = Random.randexp(rng)
randn(rng::AbstractRNG) = Random.randn(rng)

count_rand(λ) = count_rand(Random.GLOBAL_RNG, λ)
function count_rand(rng::AbstractRNG, λ)
n = 0
Expand Down
Loading