Added setRandom() to support deterministic generation