  In the present paper and the companion paper [8] a probabilistic (statistical
mechanical) approach to the study of canonical metrics and measures on a
complex algebraic variety X is introduced. On any such variety with positive
Kodaira dimension a canonical (birationally invariant) random point processes
is defined and shown to converge in probability towards a canonical
deterministic measure on X, coinciding with the canonical measure of Song-Tian
and Tsuji. The proof is based on new large deviation principle for Gibbs
measures with singular Hamiltonians which relies on an asymptotic submean
inequality in large dimensions, proved in a companion paper. In the case of a
variety X of general type we obtain as a corollary that the (possibly singular)
K\"ahler-Einstein metric on X with negative Ricci curvature is the limit of a
canonical sequence of quasi-explicit Bergman type metrics. In the opposite
setting of a Fano variety X we relate the canonical point processes to a new
notion of stability, that we call Gibbs stability, which admits a natural
algebro-geometric formulation and which we conjecture is equivalent to the
existence of a K\"ahler-Einstein metric on X and hence to K-stability as in the
Yau-Tian-Donaldson conjecture.
