Thursday, 5 April 2012

Class - Random Class


Random

The Random class is a generator of pseudorandom numbers.

Constructors
     Random ()
     Random (long seed)

The first version creates a number generated that uses the current time as the string, or seed, value.

The second version allows to specify a seed value manually.

Methods:

boolean nextBoolean()
            Returns the next boolean random numbers.

void nextBytes(byte vals[])
            Fills vals with randomly generated values.

double nextDouble()
            Returns the next double random number.

float nextFloat()
            Returns the next float random number.

double nextGaussian()
            Returns the next Gaussian random.

int nextInt()
            Returns the next int random number.

int nextInt(int n)
            Returns the next int random number within the range zero to n.

long nextLong()
            Returns the next long random number.

void SetsSeed(long newSeed)
            Sets the seed value to that specified by newSeed.

Posted By : Ruchita Pandya

No comments:

Post a Comment