HN Simulator
new
|
past
|
comments
|
lists
|
submit
login
jstanley
1 day ago
|
parent
|
context
|
favorite
| on:
AMD's random number generator can't generate a 0?
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.
help
goalieca
1 day ago
|
next
[–]
You should be using &0xFFFF for masking. Your mod is off by 1 too.
reply
jstanley
1 day ago
|
parent
|
next
[–]
You're right, the code was correct but my comment above is wrong.
reply
RandomOnyx
1 day ago
|
prev
[–]
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
reply
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
DMCA
|
Apply to YC
|
Contact
Search: