Allow to specify a custom random number generator

to be used instead of `Math.random()`. Useful when a more secure RNG is needed (i.e. based on the browser's `crypto.getRandomValues()` or nodejs's `crypto.randomBytes()`), or when a seeded rng is needed (i.e. the [seed-random](https://github.com/ForbesLindesay/seed-random) library).