Reverse engineering a probability distribution given mean/SD Say I'm working with some data, knowing only its mean and standard deviation. I want to scale this data according to some weird (non-Gaussian) distribution. How would one draw random variables from said hypothetical distribution with the aforementioned mean/sd? Would it just be the case of, "Generate a random sample from a distribution (say, a Lévy distribution), and then multiply those variables by the wanted sd and then add the mean"?
If done in R, could I just do something like:
N=1000
m=0.87
sd=0.12
z=rlevy(N)
x=sd*z+m

 A: It would be easier to respond coherently, if you had made your objective clear. Do
you want to preserve anything of the original data except the sample mean
and SD? (Outliers? Bimodality?) Just from your description, this sounds more like 'fudging' than
'engineering'.
Here is an outline of one way to do this, assuming the original data are
$\mathsf{Unif}(0,1).$

*

*Find the average $A$ and standard deviation $S$ of the original data: $U_1.$


*Use the inverse-CDF of the desired 'wierd' distribution to transform
the original data to that distribution to get $X_i.$


*Standardize the $X_i$ to have sample mean 0 and SD 1: $Z_i.$


*The 'engineered' data are $Y_i = SZ_i + A.$
The R code below gives 'engineered' (shifted) exponential data:
set.seed(1221)
u = runif(100);  a = mean(u);  s = sd(u);  a;  s
[1] 0.544287
[1] 0.301747
x = -log(1-u)  # exponential data
z = (x-mean(x))/sd(x);  y = s*z + a
mean(y); sd(y)
[1] 0.544287
[1] 0.301747
boxplot(u,y, col="skyblue2", pch=19)


Note: (a) If the original data are not uniform, perhaps transform them to lie in $(0,1).$ (b) Levy data seem problematic because the distribution is so long-tailed that the expectation does not exist. (And this makes me even more curious about your objective.)
