random

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • angah
    New Member
    • Sep 2007
    • 1

    #1

    random

    how to generate random number using math.
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Using the Random.java class. Google it and have a look at the first hit.

    Comment

    • sateesht
      New Member
      • Apr 2007
      • 41

      #3
      Hi,

      You can use Math.random() method to generate double numbers randomly, if u want to generate the random positive Integers use the nextInt() method of Random class as below.

      Random r= new Random();
      Math.abs(r.next Int());



      Cheers,
      Sateesh.

      Comment

      Working...