← Back to archive
Programming Notes

The Difference Between RDRAND and RDSEED in Intel CPUs

随机数

When considering making a test of generating hexagrams from true random numbers, I found documents stating that the difference between RDSEED and RDRAND is that RDRAND uses a CTR-DRBG with a 128-bit AES key, while RDSEED obtains its output directly from the true random number generator (neither uses the true RNG's raw output directly—those outputs have been processed with AES-CBC-MAC to prevent outsiders from learning internal operational details by observing the output).

In Intel's "The Difference Between RDRAND and RDSEED," the difference in how the two are used is stated as follows:

"The decision process for which instruction to use is mercifully simple, and based on what the output will be used for.

  • If you wish to seed another pseudorandom number generator (PRNG), use RDSEED
  • For all other purposes, use RDRAND

That's it. RDSEED is intended for seeding a software PRNG of arbitrary width. RDRAND is intended for applications that merely require high-quality random numbers."

If you intend to use it as a seed for other PRNGs, you can consider RDSEED; otherwise use RDRAND.

DRNG_img02

Written by Master Sanfu on November 17, 2016. Please credit the source if you share.

Translation Notice: This English version was translated with AI assistance. Specialized, historical, religious, or culturally sensitive terms may contain nuances, inaccuracies, or debatable wording. In case of ambiguity or discrepancy, the original Chinese text shall prevail.