added function which generates random key