how generate a variable with his density of distribution

Hello, I want generate a variable with the next density of distribution:

f(x)=(2*e^(-(x^2)/2))/ √(2π) if x ≤ 0 & f(x) = 0 if x > 0.

√= Square Root
π= Pi=3.141592

i dont know how generate this distribution and make after this a simulation in Stata for see His consistence, my primordial problem is with the distribution rather than the simulation.

Thank and im new in stata


Ambassador to the humans
Looks to be the half normal distribution. If you take the absolute value of a standard normal random variable you end up with what you have.

So if you were looking to simulate this then just simulate standard normals and take their absolute values.