1
$\begingroup$

I know that it is impossible to generate truly random numbers on a deterministic device. My question is if I paired multiple pseudo-random number generators (PRNG), would that make the outcome more random. Say device 1 generates 10 numbers and device 2 generates a single number to use as an index to select a number from device 1. What would their total randomness be? Would it be more random? Does randomness add? Like resistors in parallel? In series?

I'm not sure how to define "more random", but I mean it in the sense that people say that some PRNGs are cryptographically secure (CSPRNG) and others are not. What would be the result if device 1 was CSPRNG and device 2 was not? What about the other way around?

My intuition tells me that in this implementation the result couldn't be less random than device 1 and that device 2 might not have any impact (so randomness_device1 + randomness_device2 = randomness_device1).

$\endgroup$
  • 4
    $\begingroup$ This is not how randomness works otherwise any deterministic device could be used to create a perfectly random device by repeatedly using its own output as the index for itself. Any such approach is eventually periodic. $\endgroup$ – Peter Foreman Aug 9 at 20:48
  • 2
    $\begingroup$ @PeterForeman No. I think you should say "any deterministic device could be used to create an arbitrarily random device", not "perfectly random" $\endgroup$ – mathworker21 Aug 9 at 20:54
  • 4
    $\begingroup$ Using random algorithms for random number generation tends to lead to quite bad random. There is an instructive example of this phenomenon in Knuth, The Art of Programming, Vol II $\endgroup$ – Hagen von Eitzen Aug 9 at 20:54
  • $\begingroup$ @mathworker21 That is a better choice of wording but I can't edit the comment now. $\endgroup$ – Peter Foreman Aug 9 at 20:56
  • 1
    $\begingroup$ @PeterForeman it's more than wording, but no problem $\endgroup$ – mathworker21 Aug 9 at 20:57
3
$\begingroup$

The answer, as it so often is, is 'it depends'. On the one hand, techniques like this can definitely be viable; similar ideas are proposed in The Art Of Computer Programming. On the other, asserting 'more randomness' is no substitute for statistical testing; without an analysis specific to the PRNGs in question, it's entirely possible that there are correlations lurking that you might not be aware of and that will substantially derandomize the result.

As a for-instance (not strictly an example of your scheme, but analagous): while working on a short presentation on random numbers for my job, I looked into different varieties of quasi random number generator (roughly, generating numbers that are guaranteed to be roughly equidistributed through a range while not being regular; see e.g. https://en.wikipedia.org/wiki/Low-discrepancy_sequence). Two well-known ways of generating one-dimensional quasirandom sequences are the Weyl Sequence based around the golden ratio, and Van der Corput sequences. (See https://math.stackexchange.com/a/2847745/785 for some fine illustrations) On the surface, these two methods would seem to be completely different — they're based around entirely different structures, after all — and so it seemed not unreasonable to expect that combining the two sequences would give a low-discrepancy two-dimensional sequence. When I tried, though, this was the result:

Two-dimensional not-so-low-discrepancy sequence

As the quip goes, "the generation of random numbers is far too important to be left to chance"...

$\endgroup$
  • $\begingroup$ When you say "it depends", it sounds like you disagree with the comments on the question which sound more like "absolutely not". Can you provide an example of when it does work? $\endgroup$ – jss367 Aug 9 at 22:10
  • 1
    $\begingroup$ @jss367 I don't have the reference to hand at the moment, but the multiply-mentioned The Art Of Computer Programming (which I heartily recommend if you haven't seen it) describes some methods for doing this. I was going to suggest that the Mersenne Twister is at some level an implementation of these ideas, but I'm not quite as familiar with the operation of that RNG as I should be. $\endgroup$ – Steven Stadnicki Aug 9 at 23:46
0
$\begingroup$

According to Numerical Recipes one of the popular random number generators at least used to be a linear congruential generator. Given a seed $n$ it would compute $an+b \pmod c$ and report the result. If the coefficients are reasonably chosen this will be equally distributed across all the residues $[0,c-1]$ but there is obviously a lot of correlation between successive random numbers. That may matter to the user or not. If you take sequential numbers and use them as coordinates in a multidimensional space they tend to be located on a number of lower dimensional subspaces. Think of the image in Steven Stadnicki's answer, but instead of spots you get straight lines. They provide an algorithm to fill an array with a bunch of random numbers, then pick one out of the array and replace it, saying it will destroy (pretty much) these correlations. They also report a remark from a help desk person, who got a complaint about the reduced subspaces, to the effect that we guarantee that one number is random. We don't guarantee more than one.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.