Moved pseudo-random generator into its own library, simplified its interface and internals.