One of the question my friend was asked in technical interview :
The probability density function for a normal random variable with μ = 0.6 and σ = 0.7:
Below is the code to generate the graph :
{μ, σ} = {0.6, 0.7};
{xlow, xhigh} = {μ - 4 σ, μ + 4 σ};
Clear[pdf, x, t];
pdf[x_] = D[Normalcumdist[x, μ, σ], x];
pdfplot = Plot[pdf[x], {x, xlow, xhigh}, PlotStyle -> {{Thickness[0.01], Purple}}, AxesLabel -> {"x", "pdf[x]"}, AspectRatio -> 1/GoldenRatio]
The natural logarithm of a certain random variable Y has the probability density function plotted above.
Your job is to generate a data set whose cumulative distribution function can be expected to give a good approximation of the true cumulative distribution function of Y.
My friend answered with below code but is incorrect.
x = RandomReal[{-2, 2}, 50];
z = x - Mean[x];
stdNorm = 0.7/StandardDeviation[z];
StandardDeviation[stdNorm z];
new = stdNorm z + 0.6
{Mean[new], StandardDeviation[new]}
Can anyone please explain what is wrong here ? How to transform the result set we obtained in the our code to meet the question requirement ?