Added "synchronized" method to create random number in case of multi-thread issue