# Is it possible to store the result of a distribution function at an instant in an array?

Is there a way one can store the instantaneous results of a probability distribution function (like the ones in Distributions.jl into a data structure? Here is how my code is set up right now attempting to do this:

``````dt = 10^(-5) # timestep
t = range(0, 1.0, step=dt)

f_s = zeros(length(t)+1)
f_s = Uniform(0,1)
``````
``````MethodError: Cannot `convert` an object of type Uniform{Float64} to an object of type Float64
Closest candidates are:
convert(::Type{T}, ::T) where T<:Number at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\number.jl:6
convert(::Type{T}, ::Number) where T<:Number at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\number.jl:7
convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at C:\Users\Acer\AppData\Local\Programs\Julia-1.7.0\share\julia\base\twiceprecision.jl:262
``````

The reason I ask this is because I plan to numerically solve a linear partial differential equation which essentially starts with some given distribution, but if one timesteps it enough, it is supposed to tend to a chi distribution with 3 degrees of freedom (if interested or seeking more information, I could share more details).

The error message here is telling you that `fs_1` is an element of an Array of `Float64` but the value you are trying to store in it, is of type `Uniform{Float64}`.

instead of `f_s = zeros....` do
`f_s = Vector{Uniform{Float64}}(undef, length(t)+1)`

or if you really need them to be initialized to zero

`[Uniform{Float64}(0.0,0.0) for _ in 1:length(t)+1]`