random generation bugfix