JuliaRandom / RandomNumbers.jl

Random Number Generators for the Julia Language.
https://juliarandom.github.io/RandomNumbers.jl/stable
Other
97 stars 23 forks source link

Usage with Multinomial draws #39

Closed rohitvarkey closed 6 years ago

rohitvarkey commented 6 years ago

This is more of a question than an issue. Apologies if this is not the right place!

I'm porting some code to using RandomNumbers because I need parallel random number generation. I'm using an array of Random123.Threefry4x as an rng for each thread.

My current code does something like rand(Multinomial(1, multinomial_probabilities))). Is there a way I can pass in the specific thread rng to be used for the Multinomial draw rather than the default global rng?

Thanks, Rohit

sunoru commented 6 years ago

Hello. Are you using Distributions.jl for Multinomial? Unfortunately they don't support custom RNGs yet, so the only way to use this package is to implement the distribution functions by yourself.

rohitvarkey commented 6 years ago

Are you using Distributions.jl for Multinomial?

I was.

Unfortunately they don't support custom RNGs yet, so the only way to use this package is to implement the distribution functions by yourself.

I ended up doing something like that in the end.

Thanks for the clarification!