Please do! It's actually an open issue: https://github.com/JuliaStats/Distributions.jl/issues/197 but there is no reason we can't do it now for Distributions that don't call Rmath code (such as Exponential).
Simon On Thursday, 2 October 2014 23:58:09 UTC+1, Andrew Dolgert wrote: > > Darn, now it's on me. I've read the codebase, and could add the feature > with a little work. It's just a method on rand(), coupled with pulling > code, such as ziggurat, out of Base. > > Thanks, > Drew > > On Wednesday, October 1, 2014 11:39:16 PM UTC-4, John Myles White wrote: >> >> Hi Andrew, >> >> It sounds like you've got a lot of interesting ideas for improving >> Distributions.jl. Please read through the existing codebase when you've got >> some time and submit pull requests for any functionality you'd like to see >> changed. >> >> In regard to your main question, I don't believe we support special RNG's >> in Distributions. >> >> -- John >> >> On Oct 1, 2014, at 8:32 PM, Andrew Dolgert <[email protected]> wrote: >> >> It doesn't seem possible to use an explicit random number generator to >> sample a distribution: >> >> rng=MersenneTwister(seed) >> rand(Distributions.Exponential(scale), rng) >> >> Did I miss a way to do this? >> >> I want to use an explicit generator because >> - I can serialize it and pick up where I left off with the next run >> - I can use different generators in different parts of the program >> - It's good hygiene for stochastic simulations to know when rand is used. >> >> Using quantile(distribution, rand(rng)) isn't great because it doesn't >> use the accepted sampling algorithms. For instance, the ziggurat algorithm >> for exponentials is far better than inverting the cdf. >> >> Thanks, >> Drew >> >> >>
