# Testing the human random number generator algorithm

I came across the "Human RNG" blog post today. Its author analyzes the distribution of random numbers given by 8500 students and proposes the following algorithm for generating approximately random numbers when querying humans for random numbers:

``````- Ask a person for a random number, n1.
- n1=1,2,3,4,6,9, or 10:
- Your random number is n1
- If n1=5:
- Ask another person for a random number (n2)
- If n2=5 (12.2%):
- Your random number is 2
- If n2=10 (1.9%):
- Your random number is 4
- Else, your random number is 5
- If n1=7:
- Ask another person for a random number (n2)
- If n2=2 or 5 (20.7%):
- Your random number is 1
- If n2=8 or 9 (16.2%):
- Your random number is 9
- If n2=7 (28.1%):
- Your random number is 10
- Else, your random number is 7
- If n1=8:
- Ask another person for a random number (n2)
- If n2=2 (8.5%):
- Your random number is 1
- Else, your random number is 8``````

In this blog post, I propose to use this algorithm and verify that it works as advertised by the author.

To do this, we will first generate random numbers according to how humans generate random numbers (using our computer). Then, we will implement the algorithm and see if it yields a uniform distribution of random numbers between 1 and 10.

# Generating random numbers like a human, using a computer¶

Let's start by downloading the same data than the blog writer and extract the counts for each number.

In :
```import pandas as pd

"""Loads the data and returns counts for each number."""
```import hvplot.pandas