2 ms·
But the price you pay is having input values that are a lot wider than you need, so you waste random input bits. Generating those can be costly, too.
by Someone 6y ago
But the price you pay is having input values that are a lot wider than you need, so you waste random input bits. Generating those can be costly, too.
- BeeOnRope 6y agoYes, although it doesn't necessarily have to be "a lot". E.g., if you want random values between 1 and 1,000,000 that takes ~20 bits of entropy, but if you use 25 bits and Lemire's technique you'll be running at almost full speed because of the 5 extra bits (you fall into the slow case about 3% of the time).