refactored the generate function to allow for a version seeded with a key