fixed problem in generate random values