[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

random number generator

hi,

from the JDK source codes, i noticed a code stating

"private static Random randomNumberGenerator".

So for this code, which is the data type? And in this instance, is randomNumberGenerator the variable name?

Thanks
0
eturfclub
Asked:
eturfclub
  • 3
1 Solution
 
suprapto45Commented:
Yes,

randomNumberGenerator is the variable name with the type of Random. You may be interested to look at what Random class contains.

Regards
Dave
0
 
eturfclubAuthor Commented:
random class in the util package?
0
 
mjmohanCommented:
Hi,
    randomNumberGenerator is the class instance for Random (class data type). If I am not wrong, you are referring to java.util.Random class.  This class is used to generate the random numbers.
   Java data types can be primitive (int, float etc.) or Objects (as in the example). Object values are created by instantiating classes, which may either be built-in or program-defined.
0
 
suprapto45Commented:
Yes,

it is in the java.util package.

So "private static Random randomNumberGenerator" is similar to "private static String randomNumberGeneratorString".

Regards
Dave
0
 
suprapto45Commented:
You may have a look on how to use Random class on URL below.

http://www.ibiblio.org/javafaq/course/week4/54.html

Regards
Dave
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now