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.