OpenGammaProject / Open-Gamma-Detector

☢️👁️ Hardware for a hackable DIY gamma-ray spectrometer using a popular NaI(Tl) scintillator, SiPM and a Raspberry Pi Pico.
GNU General Public License v3.0
254 stars 35 forks source link

TRNG 0 overrepresented #20

Closed NuclearPhoenixx closed 1 year ago

NuclearPhoenixx commented 1 year ago

Tested the new TRNG implementation and it seems like, clearly, something is causing the number 0 to be overrepresented in the overall distribution.

rand

Could use some help, honestly. I don't know why this is happening.

Here's the implementation in code: https://github.com/Open-Gamma-Project/Open-Gamma-Detector/blob/3d533b5baf8feb87b8bed964eedb91ee0a7cda5d/software/opengamma_pico/opengamma_pico.ino#L512-L539

NuclearPhoenixx commented 1 year ago

I did a second test with the TRNG today, about 13 hours of recording the serial interface through Gamma MCA, with ~1 new random number per second. This is the result (ignore the axis labels):

gamma_mca_export

The distribution looks pretty good to me, most importantly, there is no longer an overrepresented number or any other obvious outlier. Looks like an error with my first test, to be honest. I didn't change anything in the implementation of the TRNG.

I'll close the issue for now, since it looks good. As always, don't use it for important stuff like your PC entropy, except if you test it extensively beforehand. And if you do so, please let me know of the results! 😉