Towards formulating quantum gravity, we present a mechanism of the emergence of spacetime geometry from randomness. In [Fukuma-NM-Umeda, [arXiv:1705.06097]], we defined for a given stochastic process "the distance between configurations," which enumerates the difficulty of transition. In this talk, we consider large-N matrix models, in which we regard eigenvalues as spacetime coordinates. We define the distance from the effective stochastic process for one eigenvalue, and argue that this definition can be interpreted in noncritical string theory as probing the classical geometry with a D-instanton. We further show that, when we apply our formalism to the U(N) matrix model by treating the 't Hooft coupling as another dynamical variable, an AdS black hole geometry emerges in the extended configuration space, where the horizon corresponds to the Gross-Witten-Wadia phase transition point. This talk is based on [Fukuma-NM, in preparation].