Open jacereda opened 2 years ago
Thank you for reporting this. This should be a simple fix since I had intended to remove that function. LIBC_RAND
provides a uint64_t rdrand()
function which can serve as a drop-in replacement. It performs all the appropriate CPUID checks. It's even smart enough to know if you're using a CPU model where RDRAND is buggy or slow (i.e. most AMD models) and will use the getrandom() system call instead. See:
Contributions welcome to help us simplify and improve consistency of random code. More eyeballs on the random code would also help too, due to its importance.
I had to disable the
rdrand
path to avoid crashes on my box.https://github.com/jart/cosmopolitan/blob/39bf41f4eb25dc6b295bda6b3c254d4615cae1d4/third_party/python/Python/random.c#L464
Could this use
cpuid
to check the presence ofrdrand
and fallback to the old code in that case?