This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Java Math random example
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see about Java math random example. Math’s random method provides you positive signed double value from 0.0 to 1.0. Syntax This method can be used in multithreaded environment as it is thread safe. If you see the source code for random math, you will see that it uses java.util.Random class’s nextDouble() method to generate random number between 0.0 to 1.0. Source code of Math’s random() method So you can see from above code, random methods uses java.util.Random class to generate random number. Example Let’s say you want to generate random integer from 1