The ground state of highly damped PdNi based 0-pi ferromagnetic Josephson junctions shows a spontaneous half quantum vortex, sustained by a supercurrent of undetermined sign. This supercurrent flows in the electrode of a Josephson junction used as a detector and produces a phi(0)/4 shift in its magnetic diffraction pattern. We have measured the statistics of the positive or the negative sign shift occurring at the superconducting transition of such a junction. The randomness of the shift sign, the reproducibility of its magnitude, and the possibility of achieving exact flux compensation upon field cooling are the features which show that 0-pi junctions behave as classical spins, just as magnetic nanoparticles with uniaxial anisotropy.