Tagged articles
ThreadLocalRandom
13 articles · Page 1 of 1
The article revises a supermarket checkout performance test by incorporating elderly customers who take twice as long to pay, demonstrates using Java's ThreadLocalRandom to randomly assign customer age groups, modifies the pay() method to double payment time for seniors, and explains why realistic scenarios improve testing accuracy.
ConcurrencyJavaSimulation
0 likes · 4 min read

The article explains why ThreadLocalRandom should not be stored in a static field, demonstrates how using ThreadLocalRandom.current().nextX(...) avoids predictable random numbers, compares behavior between JDK 11 and JDK 19, and provides the proper usage pattern with code examples.
ConcurrencyJDK11Java
0 likes · 3 min read

The article analyzes two common random‑number scenarios in software testing, identifies a CPU‑heavy custom random method, benchmarks ThreadLocalRandom, AtomicInteger, and plain int implementations under multi‑ and single‑thread loads, and proposes a lightweight AtomicInteger‑based selector that consistently delivers the best performance.
ConcurrencyJavaThreadLocalRandom
0 likes · 7 min read

This article presents a detailed benchmark of java.util.concurrent.ConcurrentHashMap under high thread counts, explains the test methodology using a Groovy‑based FunTester framework, shares raw performance numbers, and uncovers that CPU limits and random number generation are the primary bottlenecks.
ConcurrentHashMapJavaMultithreading
0 likes · 7 min read

This article explains how seeding Java's Random with specific integer values generates deterministic character sequences that spell "hello world", walks through the underlying ASCII conversion, shows code examples, and discusses related Java source quirks and seed‑search techniques.
JavaSEEDThreadLocalRandom
0 likes · 10 min read

This article examines Java's Random performance issues under high concurrency, explains how ThreadLocalRandom uses Unsafe for per‑thread seeds, explores the safety implications of native memory operations, and answers common questions about its design and memory layout.
ConcurrencyJavaMemory
0 likes · 10 min read

This article examines Java's Random performance limitations, explains how ThreadLocalRandom leverages the Unsafe class for per‑thread seed management, analyzes the underlying native methods, discusses safety concerns and memory layout, and shares practical code examples and insights for high‑concurrency applications.
ConcurrencyJDKThreadLocalRandom
0 likes · 10 min read

This article explains how ThreadLocalRandom in JDK7 improves multithreaded random number generation, compares it with Random and Math.random(), analyzes the underlying linear congruential algorithm, and provides practical code examples for high‑performance Java applications.
ConcurrencyJavaThreadLocalRandom
0 likes · 9 min read

This article explores the performance drawbacks of java.util.Random in high‑concurrency scenarios, explains how ThreadLocalRandom leverages Unsafe for per‑thread seeds, examines native getLong/putLong operations, and discusses memory layout nuances such as compressed oops and potential pitfalls.
ConcurrencyJavaThreadLocalRandom
0 likes · 10 min read

This article reviews four Java random number generation techniques—Random, ThreadLocalRandom, SecureRandom, and Math.random()—detailing their usage, underlying algorithms, thread‑safety, performance trade‑offs, and appropriate scenarios, helping developers choose the right tool for their applications.
ConcurrencyJavaMath.random
0 likes · 15 min read

This article examines Java's Random performance issues in high‑concurrency environments, explains how ThreadLocalRandom leverages sun.misc.Unsafe for lock‑free per‑thread seeds, and explores the associated memory layout, safety concerns, and practical code examples.
ThreadLocalRandomUnsaferandom
0 likes · 10 min read

This article explains how Java's random number utilities—Math.random, java.util.Random, ThreadLocalRandom, and SecureRandom—work, covering their algorithms, thread‑safety, usage examples, code snippets, and when to prefer cryptographically secure generators for security‑critical applications.
JavaMath.randomSecureRandom
0 likes · 10 min read

This article examines how Java's built‑in Random class works, its predictability and thread‑contention issues, and why SecureRandom and ThreadLocalRandom are essential for security‑critical or high‑concurrency scenarios, helping developers avoid common pitfalls when generating random numbers.
JavaSecureRandomThreadLocalRandom
0 likes · 5 min read
