Numeric Random generator

I would like to generate only random numbers in my simulation just like Random.alphanumeric.take(4).mkString. When tried with system.currentmillis,it didn’t worked for me.Is there any any other alternative to generate those numbers .

You can user Random.nextLong()

Yeah…just tried Random.nextLong().It didnt worked as i expected
But i need the generating random numbers to be only 8 values.My scenario is to generate random mobile numbers.Any idea on this

You want to generate a random phone number? Does that phone number need to be valid? A phone number is NPA-NXX-LINE. There are only so many NPA (area code) values that are valid. You can select one at random. I’m not sure, but I think there are probably rules about what values for NXX are valid. As for LINE, everything from 0000 to 9999 are valid. Given that information, you should be able to generate the phone number as a string concatenated one section at a time.