Allow to specify a custom random number generator

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