Generating matrix random variables in Multi-Threaded mode with Distributions

I now understand (from Multi-threading) that I need to generate random seeds for each thread to avoid race conditions if I wish to speed up the generation of independent random variables. One good and straightforward way of doing this is the following code snippet from

using Random
import Future

rseed = let m = MersenneTwister(1)
    [m; accumulate(Future.randjump, fill(big(10)^20, Threads.nthreads()-1), init=m)]

The problem is that I wish to generate Inverse Wishart random variables from the Distributions package but find that Iā€™m unable to do so because of the way the related InverseWishart() function and its extensions are defined. Executing

rand( rseed[1], InverseWishart( 5, [1.0 0; 0 1] ) )

will return

ERROR: ArgumentError: Sampler for this object is not defined

Wonder if anyone would be able to guide me to a workaround? I tried looking the base codes of the function InverseWishart from
to try and work something out but struggled to understand and meaningfully manipulate their definitions to my favour.

1 Like

This works for me on Julia v1.0.3 and v1.1.0 with Distributions v0.17.0.

What versions are you using?

1 Like

It does work now @greg_plowman.

I was using Distributions v0.16.4.

Thanks for the heads up.