You may have more luck with some of the rngs from packages. RandomNumbers
has the following:
julia> let rng = RandomNumbers.Xorshifts.Xoroshiro128()
global g(r::Number) = (Random.seed!(rng, hash(r)); randn(rng))
end
g (generic function with 1 method)
julia> g(1)
1.1158401688820527
julia> g(1)
1.1158401688820527
julia> @benchmark f(1)
BenchmarkTools.Trial:
memory estimate: 152 bytes
allocs estimate: 4
--------------
minimum time: 9.860 μs (0.00% GC)
median time: 9.950 μs (0.00% GC)
mean time: 10.096 μs (0.00% GC)
maximum time: 26.180 μs (0.00% GC)
--------------
samples: 10000
evals/sample: 1
julia> @benchmark g(1)
BenchmarkTools.Trial:
memory estimate: 0 bytes
allocs estimate: 0
--------------
minimum time: 7.708 ns (0.00% GC)
median time: 7.768 ns (0.00% GC)
mean time: 7.889 ns (0.00% GC)
maximum time: 24.985 ns (0.00% GC)
--------------
samples: 10000
evals/sample: 999
Though I’m not too familiar with the particulars of that generator…