fixed random number generator + added dialog for key control