Identifying a distribution I am trying to understand what sort of distribution is produced by the following code.
Using the following Matlab code we can generate a distribution (normalized such that the sum of the set is equal to 1):
M=500; % Number of samples
z=5;
SUM = 1;
ns = rand(1,M).^z; % Uniformly distributed random numbers to the power of z
TOT = sum(ns);
X = (ns/TOT)*SUM; % Re-scaling
hist(X(1,:),100)

For the exponent $z=1$ the sampling distribution is essentially "flat", and it also has a small range. Enlarging $z$ gives a wider range of numbers. Here is an example:

I would like to classify this distribution and understand the underlying mathematics.
Any explanations would be greatly appreciated.
 A: I will show this for $U^2,$ instead of $U^5.$ See @olooney's comment below my Answer.
Short answer: If $U \sim \mathsf{Unif}(0,1),$ then $X = U^2 \sim \mathsf{Beta}(\frac 1 2, 1).$
Proof: For $x \in (0,1),$ we have
$$F_X(x) = P(X \le x) = P(U^2 \le x) = P(U \le x^{1/2}) = x^{1/2}.$$
Then $f_X(x) = F_X^\prime(x)$ is easily seen to be the density of
$\mathsf{Beta}(\frac 12, 1).$ See Wikipedia on beta distributions.
Demonstration by simulation:
set.seed(618) 
u = runif(10^6);  x = u^2
mean(x)
[1] 0.3330528     # aprx E(X) = 1/3 from simulation
.5/(.5+1)
[1] 0.3333333     # exact E(X) from formula

cutp.u = seq(0, 1, by = 0.1);  cutp.x = cutp.u^2
frb = rainbow(12)
par(mfrow = c(1,3))
  hist(u, prob=T, br=cutp.u, col=frb, ylim=c(0,10), main="UNIF(0,1)")
   curve(dunif(x), 0, 1, add=T, n=10001, lwd=2)
  hist(x, prob=T, br=cutp.x, col=frb, main="BETA(.5,1)")
   curve(dbeta(x, .5, 1), add=T, lwd=2)
  hist(x, prob=T, br=40, col="skyblue2", main="BETA(.5,1)")
   curve(dbeta(x, .5, 1), add=T, n=10001, col="red")
par(mfrow = c(1,1))


In the first and second histograms, each bar contains about 100,000 simulated values. For the beta distribution in the middle histogram,
each bar is the image of a bar of the same color in the first histogram.
Ordinarily, it is not useful to make histograms with bins of unequal width, so the third histogram shows the simulated beta distribution
(and its density function in red) in a more familiar way.
