Skip to content

Instantly share code, notes, and snippets.

@lzkelley
Created July 22, 2019 17:58
Show Gist options
  • Save lzkelley/dab81e38c495d44306864a335955d210 to your computer and use it in GitHub Desktop.
Save lzkelley/dab81e38c495d44306864a335955d210 to your computer and use it in GitHub Desktop.
random-stuff
import numpy as np
import scipy as sp
import scipy.stats
import matplotlib.pyplot as plt
NUM = 100
xx = np.random.uniform(-1.0, 1.0, NUM)
plt.hist(xx)
NUM = 1000
SIGMA = 100
xx = sp.stats.maxwell.rvs(scale=SIGMA, size=NUM)
plt.hist(xx, bins=30)
NUM = 10000
xx = np.random.uniform(0.0, 1.0, NUM)
yy = np.power(xx, 1/3)
bins = np.linspace(0.0, 1.0, 11)
plt.hist(xx, color='blue', alpha=0.5, bins=bins)
plt.hist(yy, color='red', alpha=0.5, bins=bins)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment