Results 1 to 3 of 3
  1. #1
    matin1234 is offline Member
    Join Date
    Jun 2010
    Posts
    8
    Rep Power
    0

    Default setSeed method of Random class

    Hi
    really I can not get what this part of a code mean and what is the usage of that,thanks
    Java Code:
    setSeed(System.currentTimeMillis);

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    To change the basis from which the "random" numbers will be "generated".

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,556
    Rep Power
    25

    Default

    A random number generator is just a bunch of equations that take a starting number(seed) and compute a new number and save that number as seed for the next request. If it always starts at the same starting number/seed, it will always generate the same series of numbers. If it starts with a different number/seed it will generate a different series of numbers.
    The system clock is one way to give the generator a new/unique starting number.

Similar Threads

  1. Using the random class
    By schmitty514 in forum New To Java
    Replies: 6
    Last Post: 04-26-2010, 03:56 AM
  2. Random class
    By KM88 in forum New To Java
    Replies: 9
    Last Post: 10-27-2009, 08:55 PM
  3. Replies: 14
    Last Post: 10-19-2009, 10:57 AM
  4. Replies: 8
    Last Post: 04-19-2009, 05:50 PM
  5. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •