+ 7

What is the code inside Random class?

Just curious about how the random class works in java.

20th Apr 2017, 8:03 AM
Meharban Singh
Meharban Singh - avatar
5 Answers
+ 7
source code: http://developer.classpath.org/doc/java/util/Random-source.html notice that the first thing that happens if you call the default constructor: Random rnd = new Random(); the setSeed() method is called with the current system time as parameter next interesting thing to look at is protected synchronized int next(int bits){...} method which seems as the workhorse of this class
20th Apr 2017, 8:36 AM
Burey
Burey - avatar
+ 4
well this question arises in my mind as well
20th Apr 2017, 2:18 PM
shobhit
shobhit - avatar
+ 4
nice.... 😬😬😬
20th Apr 2017, 2:21 PM
shobhit
shobhit - avatar
+ 1
well not true
20th Apr 2017, 9:56 PM
Ciara
Ciara - avatar
+ 1
then what is the reality Ciara
22nd Apr 2017, 9:44 AM
shobhit
shobhit - avatar