Density Distributions

Hello, im trying to get the array of the discrete probability distribution of a normal distribution:

i have tried:

d = Normal() #standard
a = rand(d,1000)
x = pdf.(d, a) #even with just pdf(d,a)
plot(x)

but its not working

first do
using Distributions, Plots
then your code works on my Julia 1.5.3 (Windows)

can you post what it is returning you (the plot)?

I don’t know what you expect, but if you change your code to

using Distributions, Plots
d = Normal() #standard
x = sort!(rand(d,1000))
y = pdf(d, x) #even with just pdf(d,a)
plot(x,y)

I see a nice approximation of a gaussian bell curve.

thanks thats what i wanted, i dont understand why using sort!() works though

i dont understand why using sort!() works though

for plotting a series, you want x to be ordered (typically increasing order)

I intentionally changed the names of your variables. Think about a function f(x) = x You basically told Julia to roll a dice several times and plot the result. Assume you rolled x={2,-1,3}. Plotting x in that order clearly is not the graph of f. Ordering the arguments gives the correct result.
In the same spirit, you could change

x=sort!(rand(d,1000))

to

x=-3:0.1:3

and plot the result. But of course it is still unclear what you wanted to achieve in the first place.
Note that there is not a clear notion of a discrete normal distribution. And hence the terminology of getting the one array of the probabliity distribution is also a bit unclear.