Results 1 to 4 of 4

Thread: Random seed

  1. #1
    arthurv89 is offline Member
    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Default Random seed

    Hi all,

    I was just looking into the Random class. It uses the following code:

    Java Code:
        private static long seedUniquifier() {
            // L'Ecuyer, "Tables of Linear Congruential Generators of
            // Different Sizes and Good Lattice Structure", 1999
            for (;;) {
                long current = seedUniquifier.get();
                long next = current * 181783497276652981L;
                if (seedUniquifier.compareAndSet(current, next))
                    return next;
            }
        }
    If I look in the referenced paper, it says the number: 1181783497276652981. Does the Java-code miss the first digit (1)?

    Arthur

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,784
    Blog Entries
    7
    Rep Power
    21

    Default Re: Random seed

    Where have you found that method because I can't find it anywhere (Java 1.6)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,036
    Rep Power
    6

    Default Re: Random seed

    That particular Random class code segment doesn't exist in Java 1.6. I only found it in the source for Java 1.7.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,784
    Blog Entries
    7
    Rep Power
    21

    Default Re: Random seed

    Keep an eye on the bug database; if it truely is a typo it will be reported sooner than later.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 0
    Last Post: 01-23-2012, 10:12 AM
  2. Java Seed Encryption.
    By syst3mboot in forum Advanced Java
    Replies: 4
    Last Post: 09-05-2011, 04:57 PM
  3. random seed
    By ahmed80 in forum New To Java
    Replies: 1
    Last Post: 01-12-2011, 12:29 PM
  4. Replies: 14
    Last Post: 10-19-2009, 11:57 AM
  5. Replies: 8
    Last Post: 04-19-2009, 06:50 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
  •