I need to get random number from Intel's random generator in processor (Intel Core i3). I don't want to use any library. I want use assembler paste in C++, but I don't khow which registers and instructions should use.
Calling the RDRAND
instruction on supported CPUs (currently, only Ivy Bridge and Haswell Intel CPUs) will place a random value into a specified register. For instance, this will give you a random 64-bit value:
RDRAND %rax
On success, the carry bit will be set. See Intel's Bull Mountain Software Implementation Guide for more details. ("Bull Mountain" is the code name for Intel's hardware RNG.)