Truly Random-Number Generator
Because noise is random by nature, a noise source forms the basis of the RNG. The randomness of different types of electronic noise (shot, thermal, flicker, popcorn, avalanche, etc.) are well known. My RNG uses avalanche noise — which can be obtained from zener diodes — chosen because of its wide bandwidth and much higher amplitude compared to other noise sources. Two 12-V zener diodes (D7 and D10) are used to generate two noise signals. A differential amplifier built around T4, T5 and T6 amplifies the difference of both signals, to improve the chances that the noise signal is substantially random. This amplifier also removes common-mode signals due to interference and disturbances that may affect both diodes.
The next stage (T7) amplifies the noise signal further, up to 0.5 to 1 Vpp, which is enough for the analog comparator integrated in the ATtiny2313 micro. It also serves as an adjustable corrective filter that allows the RNG to meet the quality criteria for random signals set by standardization organizations worldwide.
The output of the analog comparator is sampled at a rate of around 800 kHz. Consequently, certain patterns in the
random bit stream may be correlated to subharmonics of the sample rate present in the noise signal. Bit patterns 0x00 and 0xFF correspond to a subharmonic of 50 kHz; patterns 0x0F and 0xF0 correspond to 100 kHz; patterns 0x33 and 0xCC to 200 kHz; and patterns 0x55 and 0xAA to 400 kHz. Too many or too few occurrences of a certain bit pattern indicate that the frequency response of the corrective filter must be adjusted to decrease or increase the gain at the ‘offending’ frequency. This can be done with DIP switches S5, S6 and S7 and by adjusting trimmers C39, C47 and P6. The sampled output of the analog comparator is recorded on the SD card in one, large file. The SD card must be formatted as FAT32 (see inset). Before the RNG is switched on, DIP switch S4 must be set to define the desired size of the file, ranging from 16 MB to 3.8 GB (see Table 1). After a successful recording a file named ‘random.hex’ is created on the SD card.