Dynamic calculation of number of random integers to get