In statistical physics (and viewing this from a classical point of view) for an isolated system we can say that a system will have an energy constant in time.
People define the following uniform probability distribution of microstates ($P$), which is also called the uniform ensemble: $P=0$ if $H(q,p)> E$ and $P\neq 0$ if $H(q,p)< E$, where $H$ is the hamiltonian of a system.
But the hamiltonian of a system is also equal to the energy of a system, so how can we say that there is a probability of, in a given system, there being a microstate, a point $(q,p)$, where the hamiltonian is less than the energy of the system; to me this probability distribution function makes no sense. Also I don't understand the reasoning behind creating it, it just seems to come out of nowhere, but am I correct in saying that the only point of having this distribution is that from this probability density, we can find that its density is concentrated at the surface of the equienergetic surface in phase-space, which allow us to define a function of the density of the microstates $(q,p)$, which in turn allows us to find the expected values of observables?