Is randomly picking random numbers more random?

132 Views Asked by At

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).

2

There are 2 best solutions below

2
On

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"...

0
On

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.