In [7]:
import random
n = 15 # number of users
frames = 1000 # number of frames sent
probs = [0.1, 0.2 ,0.3 ,0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9] #probabilities of sending
print("Using",frames,"frames and",n,"users...")
for p in probs:
success = 0
for frame in range(frames):
numSent = 0
for user in range(n):
sendProb = random.random()
if sendProb < p:
numSent += 1
if numSent == 1:
success += 1
print("Using p of",p,"there were",str((success/frames)*100) + "%","successful frames")