# Enhance CSPRNG output [duplicate]

This question already has an answer here:

If I XOR the output from 2 CSPRNG will the result be better (more random) than the output from either one? Assume one of the PRNG is biased.

-

## marked as duplicate by D.W., rath, AFS, figlesquidge, GillesDec 6 '13 at 13:09

How are they keyed? With two independent keys? Also, if one is a CSPRNG, then it cannot be biased (to be cryptographically secure means that it can't be biased). –  D.W. Dec 6 '13 at 1:47

If you XOR two independent streams of two random number generators together then the result is as strong as the strongest of the two.

-
More generally, if you XOR the streams of two independent random number generators together then the result is as strong as the strongest of the two. $\;$ –  Ricky Demer Dec 5 '13 at 8:20
How to determine if two PRNG are independent? I am thinking about using the default apple PRNG secCopyRandomBytes and the AutoSeeded RNG from the Botan library? How do I know that both of them don't do similar things inside? –  user1028028 Dec 5 '13 at 9:07
"Unrelated" is NOT the criterion. The criterion is that the keys be independently chosen, not that the algorithms be "unrelated" or "independent" (whatever that would mean). You can even use the same CSPRNG algorithm, as long as you have two independent keys. –  D.W. Dec 6 '13 at 1:49
@D.W. What I meant was that the streams are unrelated, not the algorithms. Updated my answer. –  nightcracker Dec 6 '13 at 3:06
If one is totally unbiased and the other is biased, doesn’t the bias “cut through” into the output stream of XOR, though? –  mirabilos Dec 6 '13 at 12:07