random: Random vs ThreadLocalRandom vs SecureRandom vs RandomGenerator module (seeds and a 2-output predictor, ranges and measured modulo bias, ThreadLocalRandom limits, SecureRandom algorithms and setSeed behaviour, the 13 java.util.random algorithms with split/jump, indicative timings), 16 contract tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6F5pq1M5ni1bNw8gr
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
|
||||
== The one correct way to call it ==
|
||||
ThreadLocalRandom.current().nextInt(1, 7) -> in 1..6: true
|
||||
|
||||
== It cannot be seeded ==
|
||||
setSeed(42) -> UnsupportedOperationException, message: null
|
||||
|
||||
== Each thread has its own state ==
|
||||
4 threads, distinct first values: 4 of 4
|
||||
|
||||
== Works the same on virtual threads ==
|
||||
virtual thread rolled a die: true
|
||||
Reference in New Issue
Block a user