Generating Random Numbers in Java
20 Jun 2012Random Numbers are one of most important concepts in programming paradigm. They are used in various fields ranging from generating encryption keys to simulation. They have also been used heavily on gaming platform, electronics music. The random numbers generated in computers are not random numbers, because they are not random at all and they are generated by very complex algorithm.
Here’s an easy way to generate random numbers in Java.
You could start by importing a library
Then you can use the Random object to get various facilities provided by java.util.Random.
There’s another easy way to generate Random numbers by using Math.random which generates doubles between 0 and 1.
Tweet Follow @aayushtuladhar