Asked • 03/16/19

Why does this not seem to be random?

I was running a procedure to be like one of those games were people try to guess a number between 1 and 100 where there are 100 people guessing.I then averaged how many different guesses there are. from random import randint def averager(times): tests = list() for _ in range(times): l = [randint(0,100) for _ in range(100)] tests.append(len(set(l))) return sum(tests)/len(tests) print(averager(100)) For some reason, the number of different guesses averages out to 63.6 Why is this?Is it due to a flaw in the python random library? In a scenario where people were guessing a number between 1 and 10 The first person has a 100% chance to guess a previously unguessed number The second person has a 90% chance to guess a previously unguessed number The third person has a 80% chance to guess a previously unguessed number and so on... The average chance of guessing a new number(by my reasoning) is 55%. But the data doesn't reflect this.

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.