fixed the random  number generationn