Random Number is the set of unordered arranged number. The class Random is derived from java.util.Random.An instance of Random class is used to provide you a stream of pseudorandom number.
In this Tutorial we want to describe you a code that helps you in understanding to Get Random Number. For this we have a class name Get Random Number. Inside the main method we create an instance of random class using new operator. The for loop is used to print the number and work as iterartor by using System.out.println.
1)Random.nextInt( )-The Method returns you the set of pseudorandom number executed till 10 times as specified in the for loop.
2)Random nextInt(int )-The Method returns you the pseudorandom, uniformly distributed int value one less than the specified int value.
On Execution the code show you a set of Random number in the command prompt from 0-9 in any sequence.GetRendomNumber.java
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 5, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles