4 ms·
We recently had this problem with nbdkit. Our server tries to be reasonably portable across several platforms, and needs non-cryptographically secure random nu
by rwmj 8y ago
We recently had this problem with nbdkit. Our server tries to be reasonably portable across several platforms, and needs non-cryptographically secure random numbers for various purposes including testing and error injection. I ended up replacing all calls to rand() with two of the xoshiro generators. These are actually faster than rand() with nicer properties.
https://github.com/libguestfs/nbdkit/blob/master/common/include/random.h https://github.com/libguestfs/nbdkit/blob/master/common/incl...
http://xoshiro.di.unimi.it/ http://xoshiro.di.unimi.it/
Edit: Having read the full article now, he seems to jump between requiring random numbers for monte carlo testing, and true entropy for cryptographic purposes. These requirements seem at odds with each other, so perhaps better to define the use case properly first.