Just how random can randomly picked numbers be?

Okay, so I was playing with a random number generator one day. And then I thought about a unit I was learning in math that same day, which was about probability. So I'm thinking: Just how random can randomly picked numbers be?

By this I mean "What is the probability that a randomly picked number isn't random?" So let's do it!

Alright, I opened up the Snap! editor to play with the random number block. Then I put a number from 1 to 2, then 1 to 5, and then 1 to 10. Each number would randomly be chosen for 5 rounds.

Here's the data I got:

1 to 2:

  • First attempt: 1
  • Second attempt: 1
  • Third attempt: 2
  • Fourth attempt: 1
  • Fifth attempt: 1
    You can see that out of 5 attempts, 4 of these attempts were the same number, which was 1.

1 to 5:

  • First attempt: 3
  • Second attempt: 2
  • Third attempt: 3
  • Fourth attempt: 5
  • Fifth attempt: 5
    You can see that out of 5 attempts, 2 attempts were of the same number, which was 3, and another 2 attempts were of the same number, which was 5. However, the RNG didn't choose numbers like 1 or 4, mainly prime numbers like 2, 3, and 5.

1 to 10:

  • First attempt: 2
  • Second attempt: 9
  • Third attempt: 1
  • Fourth attempt: 5
  • Fifth attempt: 3
    This time, the random number generator DIDN'T choose a number that is the same as a number it chose before.

Now I will use another random number generator and see what its results would be, and then I can see whether the results would be the same or not. Then I could use these results to determine if random number generators REALLY are randomly generated.

1 to 2:

  • First attempt: 1
  • Second attempt: 2
  • Third attempt: 2
  • Fourth attempt: 1
  • Fifth attempt: 1
    Surprisingly, the results were almost identical!

1 to 5:

  • First attempt: 3
  • Second attempt: 4
  • Third attempt: 1
  • Fourth attempt: 5
  • Fifth attempt: 2
    Welp, the results were different this time. The random number generator decided to choose all the numbers, which was either a coincidence, or on purpose.

1 to 10:

  • First attempt: 2
  • Second attempt: 9
  • Third attempt: 9
  • Fourth attempt: 8
  • Fifth attempt: 6
    You can see that out of 5 attempts, 2 of these attempts were the same number, which was 9. The first two attempts had the same number, which is weird.

So using 2 random number generators, I was able to depict if random number generators were really random or not, and here's the answer.

For the 1 to 2 tests, the tests were almost identical, and so let's just say that they likely didn't choose a random number. But they were given choices to choose numbers between 1 and 2, and so didn't really have options.

For the 1 to 5 tests, the test results were much different. The first number generator, which used Snap!, chose to choose the numbers 2, 3, and 5. It never chose the number 1 or 4. The second one, which used Google's RNG, decided to choose all the numbers, which deemed it useless. So let's just say that they likely did not choose random numbers. I mean, the first random number generator chose 2 two times in a row, which would most likely conclude that it wasn't random at all. Also the second one (Google) chose numbers 1 to 5 in different orders, which makes it basically make 5 number combinations.

For the 1 to 10 tests, the first one (Snap) chose numbers that were different every time, so no repetition or anything for us. Google's RNG choose the number 9 twice in a row, which doesn't tell me that it was randomly choosing numbers. I'd say that Snap! did a better job in choosing numbers 1 to 10 randomly.

This was just a project which I did because I was bored and dumb.

You should build a script to run the RNG thousands of times and get a more definitive answer.
Five really isn't a very big sample size...

Okay. These were just tests I did randomly because I was bored, stupid, and also I didn't know what to do other than this. So I decided to do something math-wise for a while because of

In technology, computers cannot give you a random number. Of what I remember, it use a time to give a random number. In physic world you can get a random number, for example by throw dice. So you can use to random more mathematical operations to [scratchblocks](pick random [n] to [n₃][/scratchblocks] .

There's no such thing as a single random number. Once you know the number, it's constant! When people say "a random number" they mean "a randomly chosen number," or "a number chosen in such a way that all possible values are equally likely."

So, yeah, you have to pick a lot of numbers and then you can see how they're distributed. I believe, although I've never studied statistics and it's been a long time since probability in high school, that you actually want to pick a lot of numbers a lot of times, so it's better to make ten trials of 1000 numbers each than one big trial of 10,000 numbers, because no matter how big the trial you might happen to get weird results, but you're much less likely to get the same sort of weird results ten times just by chance.

I promise that our random number generator didn't pick prime numbers for you on purpose. And Google's didn't pick all different numbers on purpose either.

But neither ours nor theirs is really a random number generator; they generate pseudorandom numbers, which means that each value is generated from the past history algorithmically, but using algorithms that have been shown to have a good distribution.

The only way to get truly random numbers is to build a device that takes advantage of quantum randomness. One classic example is to measure very precisely the voltage across a diode. That voltage is always about 0.7 volts, but the exact value depends on quantum effects in the silicon. So you subtract 0.7 and you have a random number with about 0.1 range of variation. You can buy boards that plug into your computer and provide quantum random values.

Type "diode voltage drop" into your search engine and you'll learn more than you want to know about this.

In ancient times, when MIT got its first color displays (circa 1975) I wrote a Lisp program that displayed dots at random positions with random colors. A beautiful tartan pattern emerged. I showed it to the Lisp implementers whose response was "Whoops!" and quickly fixed the random number generator. By the way, it is not only the distribution that needs to be random but there needs to be no pattern to the sequence of numbers generated.

So I just recreated my old program in Snap!. The result of iterating 100,000 times is
Stage (4)

Looks random to me.

Here's the script:
untitled script pic (46)

P.S. I recently read A Theoretical Computer Science Perspective on Consciousness by Lenore and Manual Blum (winner of the Turing Award) about Conscious Turing Machines (CTM). They mention that their CTM need not be non-deterministic since pseudo-randomness is just as good. Both of them are world-class researchers on pseudo-randomness. E.g. Blum Blum Shub - Wikipedia

When Berkeley got the contract to port Unix from the 16-bit PDP-11 to the 32-bit Vax, they didn't think to rewrite the random number library. Turns out that pseudorandomness algorithms are quite sensitive to the width of numbers! So for the first several years, all the Unix random numbers were even. Amazing that it took years before anyone noticed!

Your picture doesn't look grossly nonrandom, but, interestingly, I can see "paths" in it:
dots
... and lots more that I didn't mark. This reminds me of Kathleen Petyarre, one of my favorite artists:


Of course in her case the paths are deliberate!

I once read of someone who did very well on a state lottery that was based on 16-bit numbers. But I failed to Google the story.