Am using math.random() method to generate random numbers. but i had a doubt about that method. math.random() is which algorithms will fallow to generate random
Use java.util.Random API
An instance of this class is used to generate a stream of pseudorandom numbers. The class uses a 48-bit seed, which is modified using a linear congruential formula. (See Donald Knuth, The Art of Computer Programming, Volume 3, Section 3.2.1.)
Algorithm class : pseudorandom number generator known as PRNG. You can read more about it here.
Note : Math.random() also uses java.util.Random instance to generate the psuedo-random numbers internally