Chapter 39 — Random
Modern Java offers a rich, high‑quality random number ecosystem built around the java.util.random APIs (JDK 17+), including pluggable algorithms, explicit parallelization, and reproducibility controls. This chapter provides a practical, production‑focused tour: choosing algorithms, generating distributions, parallel patterns, and testing/benchmarking for robust simulations.
What You’ll Learn
- The
RandomGeneratorAPI and factory model - Algorithm selection: LXM family, Xoshiro/Xoroshiro,
SplittableRandom,SecureRandom - Uniform and common distributions (Gaussian, Exponential, Poisson)
- Safe parallel random generation with splitting/jumping
- Reproducibility strategies and performance benchmarking
Use this chapter to design repeatable simulations, efficient Monte Carlo workflows, and predictable test data pipelines.