<commit_before>import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np

a, b = 10, 50
mean, stdDev, limit = 37, 2, 42

z = (limit - mean) / stdDev
probability = stats.norm.sf(abs(z))

dist = stats.truncnorm((a - mean) / stdDev, (b - mean) / stdDev, loc=mean, scale=stdDev)

count = [0]
values = [0]
for num in range(10):
    values[num] = dist.rvs(100000)
    # noinspection PyTypeChecker
    for val in values[num]:
        if val > limit:
            count[num] += 1
    print(count[num])
    count.append(0)
    values.append(0)
plt.hist(count,bins=25, normed=True, alpha=0.6)
plt.xlabel("value")
plt.ylabel("frequency")
xmin, xmax = plt.xlim()
x = np.linspace(xmin, xmax, 100)
p = stats.norm.pdf(x, mean, stdDev)
plt.plot(x, p, 'k', linewidth=2)
plt.show()
# all rand items stored in values
# count holds the occurrence of 42
<commit_msg>fix zero error<commit_after>import matplotlib.pyplot as plt
import scipy.stats as stats
import numpy as np

a, b = 10, 50
mean, stdDev, limit = 37, 2, 42

z = (limit - mean) / stdDev
probability = stats.norm.sf(abs(z))

dist = stats.truncnorm((a - mean) / stdDev, (b - mean) / stdDev, loc=mean, scale=stdDev)

count = [0]*10
values = [0]*10
for num in range(10):
    values[num] = dist.rvs(100000)
    # noinspection PyTypeChecker
    for val in values[num]:
        if val > limit:
            count[num] += 1
    print(count[num] / 100000)


plt.hist(count,bins=25, normed=True, alpha=0.6)
plt.xlabel("value")
plt.ylabel("frequency")
xmin, xmax = plt.xlim()
x = np.linspace(xmin, xmax, 100)
p = stats.norm.pdf(x, mean, stdDev)
plt.plot(x, p, 'k', linewidth=2)
plt.show()
# all rand items stored in values
# count holds the occurrence of 42

{'fraction_non_alphanumeric': 0.14938488576449913, 'fraction_numerical': 0.0421792618629174, 'mean_word_length': 3.5913978494623655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2825641', 'n_tokens_mistral': 718, 'n_tokens_neox': 654, 'n_words': 189}