Finding the percentile corresponding to a threshold
If I understand your question, you are asking to determine the percentile value of the first value that exceeds the threshold. The thing to do is the following:


Specify the number of random.normal deviates in the call and pre-sort the array. That way you can just look at each element in the array, knowing that the next one is bigger than the last.
Just count the number of values that fail to exceed the threshold, stopping after you find one that exceeds it. No need to continue beyond this point.
Then, do the arithmetic.




my_vals = sorted(np.random.normal(0.05, 0.02, 60000))
count_vals = 0
for i in my_vals:
    count_vals += 1
    if i &gt; threshold_val:
        break
percentile_val = 100 * (count_vals/len(my_vals))
print('{0:0.6}'.format(percentile_val))


As a check, you could then calculate the value of the element at that percentile using np.percentile.

print(np.percentile(my_vals, percentile_val))


Even easier is to do the counting this way:

count_vals = sum(i &gt; threshold_val for i in my_vals)
percentile_val = 100 * (count_vals/len(my_vals))