Home / Function/ newSeed() — netty Function Reference

newSeed() — netty Function Reference

Architecture documentation for the newSeed() function in ThreadLocalRandom.java from the netty codebase.

Function java CommonUtil Internal calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  6aab6f7b_9b36_71ef_c98a_e545b4b09e28["newSeed()"]
  cad32658_3724_a99b_a2c9_78d6688e22b6["ThreadLocalRandom"]
  6aab6f7b_9b36_71ef_c98a_e545b4b09e28 -->|defined in| cad32658_3724_a99b_a2c9_78d6688e22b6
  fade03da_c357_2412_6ab9_f5612ffce139["ThreadLocalRandom()"]
  fade03da_c357_2412_6ab9_f5612ffce139 -->|calls| 6aab6f7b_9b36_71ef_c98a_e545b4b09e28
  934f1d75_fad9_3323_2acb_33ba4aa751de["getInitialSeedUniquifier()"]
  6aab6f7b_9b36_71ef_c98a_e545b4b09e28 -->|calls| 934f1d75_fad9_3323_2acb_33ba4aa751de
  style 6aab6f7b_9b36_71ef_c98a_e545b4b09e28 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java lines 199–221

    private static long newSeed() {
        for (;;) {
            final long current = seedUniquifier.get();
            final long actualCurrent = current != 0? current : getInitialSeedUniquifier();

            // L'Ecuyer, "Tables of Linear Congruential Generators of Different Sizes and Good Lattice Structure", 1999
            final long next = actualCurrent * 181783497276652981L;

            if (seedUniquifier.compareAndSet(current, next)) {
                if (current == 0 && logger.isDebugEnabled()) {
                    if (seedGeneratorEndTime != 0) {
                        logger.debug(String.format(
                                "-Dio.netty.initialSeedUniquifier: 0x%016x (took %d ms)",
                                actualCurrent,
                                TimeUnit.NANOSECONDS.toMillis(seedGeneratorEndTime - seedGeneratorStartTime)));
                    } else {
                        logger.debug(String.format("-Dio.netty.initialSeedUniquifier: 0x%016x", actualCurrent));
                    }
                }
                return next ^ System.nanoTime();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does newSeed() do?
newSeed() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java.
Where is newSeed() defined?
newSeed() is defined in common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java at line 199.
What does newSeed() call?
newSeed() calls 1 function(s): getInitialSeedUniquifier.
What calls newSeed()?
newSeed() is called by 1 function(s): ThreadLocalRandom.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free