From 393ed97504ec499a08e40da012b17e36959897a5 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Fri, 4 Oct 2024 14:31:16 +0200 Subject: [PATCH] Use `copy` instead of `deepcopy` for RNGs --- src/sample.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sample.jl b/src/sample.jl index 6e21f18..0559876 100644 --- a/src/sample.jl +++ b/src/sample.jl @@ -391,7 +391,8 @@ function mcmcsample( nchunks = min(nchains, Threads.nthreads()) chunksize = cld(nchains, nchunks) interval = 1:nchunks - rngs = [deepcopy(rng) for _ in interval] + # `copy` instead of `deepcopy` for RNGs: https://github.com/JuliaLang/julia/issues/42899 + rngs = [copy(rng) for _ in interval] models = [deepcopy(model) for _ in interval] samplers = [deepcopy(sampler) for _ in interval]