I'm trying to understand how randomness in not truly random in the following example:
an outcome of a first coin toss (yes/no) is only considered if the second coin toss also comes up 1/0 (1> accept yes/no ; 0> reject & toss again). Could this system be considered truly random, since the outcome of the first coin toss is dependent on the outcome of the second
Does the dependency between the two coin tosses introduce a bias into the system, making it less than truly random? I tried asking Google bard, who insisted that the system is not purely random as the second coin determines the value of the first coin. However, in my head, I can't comprehend how that could be, as the value of the second coin is random, so shouldn't the randomness be preserved (assuming first & second coins are both fair - 50/50)?
Below is a code of the demo, with which I tried to make a case for the preservation of randomness since the yes/no values always appear to be in a 50/50 ratio:
import random
# Number of times to repeat the experiment
num_trials = 1000
# Initialize counters for yes and no
yes_count = 0
no_count = 0
# Repeat the experiment num_trials times
for _ in range(num_trials):
# Toss the first coin
first_coin = random.choice(['yes', 'no'])
# Toss the second coin
second_coin = random.choice(['0', '1'])
# If the second coin is 1, count the first coin as yes
if second_coin == '1':
if first_coin == 'yes':
yes_count += 1
else:
no_count += 1
# Print the number of times yes and no came about
print("Number of times yes came about:", yes_count)
print("Number of times no came about:", no_count)
```
The outcome is still random. The second coin flip only determines whether the first coin flip is taken into account, not the result of the first coin flip. The first coin flip is still random regardless. The presence of the second coin flip will ultimately only change the amount of results recorded, which may change the final outcome, but will not change whether or not it is random.