  Numerical simulations of spin glass models with continuous variables set the
problem of a reliable but efficient discretization of such variables. In
particular, the main question is how fast physical observables computed in the
discretized model converge toward the ones of the continuous model when the
number of states of the discretized model increases. We answer this question
for the XY model and its discretization, the $q$-state clock model, in the
mean-field setting provided by random graphs. It is found that the convergence
of physical observables is exponentially fast in the number $q$ of states of
the clock model, so allowing a very reliable approximation of the XY model by
using a rather small number of states. Furthermore, such an exponential
convergence is found to be independent from the disorder distribution used.
Only at $T=0$ the convergence is slightly slower (stretched exponential).
Thanks to the analytical solution to the $q$-state clock model, we compute
accurate phase diagrams in the temperature versus disorder strength plane. We
find that, at zero temperature, spontaneous replica symmetry breaking takes
place for any amount of disorder, even an infinitesimal one. We also study the
one step of replica symmetry breaking (1RSB) solution in the low-temperature
spin glass phase.
