  At finite temperature, conserved charges undergo thermal fluctuations in a
quantum many-body system in the grand canonical ensemble. The full structure of
the fluctuations of the total U(1) charge $Q$ can be succinctly captured by the
generating function $G(\theta)=\left\langle e^{i \theta Q}\right\rangle$. For a
1D translation-invariant spin chain, in the thermodynamic limit the magnitude
$|G(\theta)|$ scales with the system size $L$ as $\ln
|G(\theta)|=-\alpha(\theta)L+\gamma(\theta)$, where $\gamma(\theta)$ is the
scale-invariant contribution and may encode universal information about the
underlying system. In this work we investigate the behavior and physical
meaning of $\gamma(\theta)$ when the system is periodic. We find that
$\gamma(\theta)$ only takes non-zero values at isolated points of $\theta$,
which is $\theta=\pi$ for all our examples. In two exemplary lattice systems we
show that $\gamma(\pi)$ takes quantized values when the U(1) symmetry exhibits
a specific type of 't Hooft anomaly with other symmetries. In other cases, we
investigate how $\gamma(\theta)$ depends on microscopic conditions (such as the
filling factor) in field theory and exactly solvable lattice models.
