Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khokm/2b23601bbca1d3d816c276b668d9ef9f to your computer and use it in GitHub Desktop.
Save khokm/2b23601bbca1d3d816c276b668d9ef9f to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
# sum_ = 0
# for i in range(0, 100000):
# sum_ += rayleigh(3)
# print('real', sum_ / 100000)
# print('mean', 3 * sqrt(math.pi / 2))
cnt = 100
sigma = 2
times = sorted(rand() for i in range(0, cnt))
# times = sorted(exp(1) for i in range(0, cnt))
# times = sorted(rayl(sigma) for i in range(0, cnt))
probs = [i / cnt for i in range(0, cnt)]
plt.figure(figsize=(5,5))
plt.plot(times, probs)
plt.xticks(np.arange(0, 5, 0.5))
plt.show()
plt.hist(times, bins=15, rwidth=0.9, density=True)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment