Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8272866

java.util.random package summary contains incorrect mixing function in table

    XMLWordPrintable

Details

    • b13
    • generic
    • generic
    • Verified

    Backports

      Description

        A DESCRIPTION OF THE PROBLEM :
        The table 'LXM Multipliers' at the end of the javadoc for the java.util.random package states that the mixing function is mixLea32 for all the 64/128-bit LCG based generators. This should be updated to mixLea64 for the 64/128-bit LCG generators. Only the L32X64MixRandom which uses a 32-bit LCG will use the mixLea32 mixing function.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Extract the source for jdk.random and search for the mix function:

        grep mixLea jdk.random/jdk/random/*

        jdk.random/jdk/random/L128X1024MixRandom.java: final long result = RandomSupport.mixLea64(sh + s0);
        jdk.random/jdk/random/L128X128MixRandom.java: final long result = RandomSupport.mixLea64(sh + x0);
        jdk.random/jdk/random/L128X256MixRandom.java: final long result = RandomSupport.mixLea64(sh + x0);
        jdk.random/jdk/random/L32X64MixRandom.java: // The low half of the seed is hashed by mixLea32 to produce the initial `x0`,
        jdk.random/jdk/random/L32X64MixRandom.java: // GOLDEN_RATIO_32 as the gamma value and mixLea32 as the mixer.
        jdk.random/jdk/random/L32X64MixRandom.java: RandomSupport.mixLea32((int)(seed)),
        jdk.random/jdk/random/L32X64MixRandom.java: RandomSupport.mixLea32((int)(seed) + RandomSupport.GOLDEN_RATIO_32));
        jdk.random/jdk/random/L32X64MixRandom.java: final int result = RandomSupport.mixLea32(s + x0);
        jdk.random/jdk/random/L64X1024MixRandom.java: final long result = RandomSupport.mixLea64(s + s0);
        jdk.random/jdk/random/L64X128MixRandom.java: final long result = RandomSupport.mixLea64(s + x0);
        jdk.random/jdk/random/L64X256MixRandom.java: final long result = RandomSupport.mixLea64(s + x0);

        Only the L32X64MixRandom is using the mixLea32 mixing function. All others use the mixLea64 function.

        This is not reflected in the java.base/java/util/random/package-info.java documentation.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Update the java.base/java/util/random/package-info.java to correct the LXM Multipliers table at the end of the file.


        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                jlaskey Jim Laskey
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: