A developer reports that AMD CPUs (reported on Zen2-class hardware) appear unable to produce an exact zero when using rdrand/rdseed to request 16-bit random values. He built an assembly test that draws a bar chart of counts for all 16-bit values: the zero bin (first bar) never changes on AMD machines while Intel systems show zeros as expected. The chart colors correspond to rdrand (red), rdseed (blue) and a custom TSC-based generator (green). He confirms that when rdrand/rdseed are used to produce full 32- or 64-bit outputs and then the low 16 bits are taken, zeros do appear, and suggests a practical fix: emit to 32/64-bit registers and truncate to 16 bits for display. The test program and source are provided for others to reproduce the behavior.
Responses on the board debate trust in hardware RNGs and suggest always mixing entropy sources for cryptographic use. The author contacted AMD, received an apparently inadequate reply, and reports the case has been escalated but no definitive resolution yet; two AMD machines he tested produced no zeros over extended runs. He also added benchmarking to the tool and notes wide performance differences: an older Core i5 produced ~12.6M rnd/s, a Core i7-7700 ~750k rnd/s, and a Ryzen 7 ~2.6M rnd/s, with AMD’s generator apparently insensitive to clock changes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.