C++ routines to calculate rank-based probability distribution and to load into MySQL database