from random import random

def sim(t, n):
    s = 0
    for _ in range(n):
        r, j = random(), random()
        if abs(r - j) <= t:
            s += 1
    return s / n
step = 100
for a in range(step + 1):
    print(f"{a/step},{sim(a / step, 10**5)}")

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: