Skip to content

Commit b471fd7

Browse files
committed
Fix random init
1 parent 1e62b59 commit b471fd7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Overlay.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ for randfun in (:rand, :randn, :randexp)
103103
return TracedRandom.$(overload_randfun!)(rng, A)
104104
end
105105
@reactant_overlay @noinline function Random.$(randfun!)(A::AnyTracedRArray)
106-
return TracedRandom.$(overload_randfun!)(TracedRandom.default_rng(), A)
106+
return TracedRandom.$(overload_randfun!)(call_with_reactant(TracedRandom.default_rng), A)
107107
end
108108
end
109109
end

src/stdlibs/Random.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ Base.copy(rng::ReactantRNG) = ReactantRNG(copy(rng.seed), rng.algorithm)
3939
end
4040
@noinline ReactantRNG(seed::AbstractVector) = ReactantRNG(seed, "DEFAULT")
4141

42-
@noinline default_rng() = ReactantRNG()
42+
@noinline function default_rng()
43+
ReactantRNG()
44+
end
4345

4446
@noinline rng_algorithm(rng::ReactantRNG) = rng.algorithm
4547
@noinline rng_algorithm(::AbstractRNG) = "DEFAULT"

0 commit comments

Comments
 (0)