Skip to content

Commit 4ad724a

Browse files
authored
Try #374:
2 parents aeb5e03 + 3ee46e1 commit 4ad724a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/contexts.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,21 @@ SamplingContext(context::AbstractContext) = SamplingContext(SampleFromPrior(), c
137137
SamplingContext(sampler::AbstractSampler) = SamplingContext(sampler, DefaultContext())
138138
SamplingContext() = SamplingContext(SampleFromPrior())
139139

140+
function SamplingContext(
141+
rng::AbstractRNG=Random.GLOBAL_RNG, sampler::AbstractSampler=SampleFromPrior()
142+
)
143+
return SamplingContext(rng, sampler, DefaultContext())
144+
end
145+
function SamplingContext(rng::AbstractRNG, context::AbstractContext)
146+
return SamplingContext(rng, SampleFromPrior(), context)
147+
end
148+
function SamplingContext(sampler::AbstractSampler, context::AbstractContext=DefaultContext())
149+
return SamplingContext(Random.GLOBAL_RNG, sampler, context)
150+
end
151+
function SamplingContext(context::AbstractContext)
152+
return SamplingContext(Random.GLOBAL_RNG, SampleFromPrior(), context)
153+
end
154+
140155
NodeTrait(context::SamplingContext) = IsParent()
141156
childcontext(context::SamplingContext) = context.context
142157
function setchildcontext(parent::SamplingContext, child)

0 commit comments

Comments
 (0)