Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
jstanley
· 2mo ago · 0 comments
Yes it does. rdrand32()%65535 was my first attempt, and generated zeroes at about the expected rate, that's why I initially erroneously thought my CPU did not have this problem.
Comments
[–]
goalieca
2mo ago
You should be using &0xFFFF for masking. Your mod is off by 1 too.
[–]
jstanley
OP
2mo ago
You're right, the code was correct but my comment above is wrong.
[–]
RandomOnyx
2mo ago
How about* rdrand32()%65536? Taking the remainder by 65535 doesn't take the lowest 16 bits after all
*: missed a word the first time around