-fixed random key generation, getTime should be a function