Probability and statistics algorithms