I use this method:
def getRandomNumber(int num){ Random random = new Random() return random.getRandomDigits(num) }
when I call it I
If you want to generate random numbers in range including '0' , use the following while 'max' is the maximum number in the range.
Random rand = new Random() random_num = rand.nextInt(max+1)