support for random in generator, fixes #678