Added random number generator parameter

A `random` argument can be provided to the function, consisting of
a function taking an argument and returning random numbers between
zero and said argument.

There is also a `random` property in `module.exports`, which is
used as the default if the `random` argument is not provided, and
which defaults to the current random number generation algorithm.

This is important because `Math.random()` may not be the best
choice, especially when considering applications with needs relating to
cryptographic strength.