All About Class Random in Java

An instance of this class Random is used to generate a stream of pseudo random numbers.The class uses a 48-bit seed,which is modified using a linear congruent formula.If two instances of Random are created with the same seed and the same sequence of method calls are made fro each,they will generate and return identical sequence of numbers.
The class structure of Random  is given as:

public class java.util.Random extends java.lang.Object{
public Random()//creates a new Random number generator.Its seed is initialized to a value based on the current time.
public Random(long seed)//creates a new Random number generator using a long seed.
public double nextDouble();
public int nextInt();
public float nextFloat();

All About Class Random in Java All About Class Random in Java Reviewed by Animesh Chatterjee on October 04, 2018 Rating: 5

No comments:

Powered by Blogger.