Tagged articles
13 articles
Page 1 of 1
FunTester
FunTester
Mar 15, 2025 · Operations

Simulating Elderly Checkout Times with ThreadLocalRandom in Java

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.

JavaPerformance TestingThreadLocalRandom
0 likes · 4 min read
Simulating Elderly Checkout Times with ThreadLocalRandom in Java
FunTester
FunTester
Jul 12, 2022 · Backend Development

Why AtomicInteger Outperforms Random() in High‑Concurrency Random Number Generation

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.

AtomicIntegerJavaPerformance Testing
0 likes · 7 min read
Why AtomicInteger Outperforms Random() in High‑Concurrency Random Number Generation
FunTester
FunTester
Jun 14, 2022 · Backend Development

Why ConcurrentHashMap Slows Down with Hundreds of Threads? A Deep Performance Test

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.

BenchmarkConcurrentHashMapJava
0 likes · 7 min read
Why ConcurrentHashMap Slows Down with Hundreds of Threads? A Deep Performance Test
Sohu Tech Products
Sohu Tech Products
Apr 27, 2022 · Backend Development

Why Using Fixed Seeds with Java Random Prints "Hello World"

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.

Hello WorldJavaThreadLocalRandom
0 likes · 10 min read
Why Using Fixed Seeds with Java Random Prints "Hello World"
Top Architect
Top Architect
Jan 1, 2022 · Backend Development

Understanding ThreadLocalRandom and Unsafe in Java: Performance, Implementation, and Pitfalls

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.

JDKThreadLocalRandomconcurrency
0 likes · 10 min read
Understanding ThreadLocalRandom and Unsafe in Java: Performance, Implementation, and Pitfalls
Programmer DD
Programmer DD
Jul 23, 2021 · Backend Development

Why ThreadLocalRandom Beats Random in Java: Deep Dive into Unsafe and Memory

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.

JavaThreadLocalRandomconcurrency
0 likes · 10 min read
Why ThreadLocalRandom Beats Random in Java: Deep Dive into Unsafe and Memory
macrozheng
macrozheng
Jun 25, 2021 · Fundamentals

Mastering Java Random Number Generation: Random, ThreadLocalRandom, SecureRandom & Math

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.

JavaMath.randomRandom Number Generation
0 likes · 15 min read
Mastering Java Random Number Generation: Random, ThreadLocalRandom, SecureRandom & Math
Programmer DD
Programmer DD
Dec 18, 2020 · Backend Development

Master Java Random Generators: Math.random, Random, ThreadLocalRandom & SecureRandom

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.randomRandom Number Generation
0 likes · 10 min read
Master Java Random Generators: Math.random, Random, ThreadLocalRandom & SecureRandom
Programmer DD
Programmer DD
Oct 8, 2019 · Backend Development

Why Java’s Random Can Fail You: Secure and Thread‑Safe Alternatives Explained

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
Why Java’s Random Can Fail You: Secure and Thread‑Safe Alternatives Explained