# Turing models: Errors when generating random numbers using parameters (Tracked reals)

**URL:** <https://discourse.julialang.org/t/turing-models-errors-when-generating-random-numbers-using-parameters-tracked-reals/70702>\
**Category:** General Usage\
**Tags:** turing\
**Created:** [October 31, 2021, 8:28pm UTC](https://discourse.julialang.org/t/turing-models-errors-when-generating-random-numbers-using-parameters-tracked-reals/70702 "2021-10-31T20:28:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Post date:** [October 31, 2021, 8:28pm UTC](https://discourse.julialang.org/t/turing-models-errors-when-generating-random-numbers-using-parameters-tracked-reals/70702/1 "2021-10-31T20:28:34Z")

</div>

Inside a Turing model, for some generated quantities, I’m doing `rand(Normal(0.0,scale))` where “scale” is a parameter. I’m getting an error:

```julia
 ERROR: LoadError: MethodError: no method matching randn(::Random._GLOBAL_RNG, ::Type{ReverseDiff.TrackedReal{Float64, Float64, Nothing}})

```

It appears that scale, being a TrackedReal, can’t be used this way? What do I do instead?

note: i tried doing `randn() * scale` and that didn’t crash. is that the right thing? how do I sample from more complicated distributions (gamma, exponential, inverse gamma, lognormal etc anything from Distributions.jl)?
