4 ms·
> Just as you wouldn't want to use a general purpose PRNG for security applications so too you wouldn't want to use a secure PRNG for general purposes, particul
by daurnimator 11y ago
> Just as you wouldn't want to use a general purpose PRNG for security applications so too you wouldn't want to use a secure PRNG for general purposes, particularly demanding applications such as Monte Carlo simulations.
Why not?
It's perfectly valid to use a secure RNG for non-secure purposes.
As I mentioned, I've used ChaCha20 for those sort of purposes too. And the random number generation barely shows up as a fraction of the runtime.
i.e. improving 1% of the runtime by 99% isn't worth the overhead of having more than one random number generator.
- danieltillett 11y agoThe reason why is crypto RNG are much slower than something less secure. It really depends on the application, but in the code I wrote today a significant fraction of my application’s time was spent in the RNG function. By replacing the RNG I managed to speed up my code by a bit over 2 fold. I am not doing crypto work so this is great.
- daurnimator 11y agoChaCha is fast. very fast. see just below: https://news.ycombinator.com/item?id=9890599 https://news.ycombinator.com/item?id=9890599 I'm not sure why they marked it as "fairly slow" in the table in the OP.
- danieltillett 11y agoFast and slow are all relative - ChaCha is relatively fast but PGC is faster.
- ars 11y ago> Why not? It's perfectly valid to use a secure RNG for non-secure purposes. It's much slower. Yes, in your application it was a fraction, but they are still much slower than non-secure RNG's.
- eterm 11y agoOne of the benefits of a PRNG is reproducibility. If you are doing a monte carlo simulation, then you can get good results while still starting runs from predictable seeds. (e.g. [0,1,2,3,4,...]) This gives you both good quality random numbers during the simulation run yet lets others reproduce your results and expand with more results if required.
- dchest 11y agoChaCha20 is a cipher, of course, it creates reproducible sequences.