Support custom random number generator in random() and shuffle()