Added random permutation code:

Added code for generating random permutations and code needed for it,
including random number generation and modular arithmetic for split numbers.