Skip to content

Instantly share code, notes, and snippets.

@optilude
Last active March 2, 2022 15:57
Show Gist options
  • Save optilude/5d9cace4fa3b001c9f8993f7d7a619ae to your computer and use it in GitHub Desktop.
Save optilude/5d9cace4fa3b001c9f8993f7d7a619ae to your computer and use it in GitHub Desktop.
Kanban lead time weibull distribution estimator
import numpy as np
def weibull_estimate(min_, max_, shape=1.25):
"""Draw a random number between min_ and max_ using a Weibull
distribution with shape `shape`.
Thanks to Troy Magennis for the inspiration!
"""
return min(max_, ((max_ - min_) / 4.0) * np.random.weibull(shape) + min_)
# e.g. to plot a histogram:
import matplotlib.pyplot as plt
plt.hist([weibull_estimate(5, 20) for x in range(1000)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment