Implemented the distribution function with Cython, to make the script faster.
The difference is dramatic - in a test, the execution time has been reduced
from 15s to 0.8s.
Improved the readability of the scripts.
Some more readability improvements
Small tweaks