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,19 @@
|
||||
|
||||
== Same seed, same sequence ==
|
||||
Random(42) #1: 30 63 48 84 70
|
||||
Random(42) #2: 30 63 48 84 70
|
||||
|
||||
== No seed: every instance starts somewhere different ==
|
||||
new Random() #1: 94 42 76
|
||||
new Random() #2: 86 37 29
|
||||
(these two lines differ on every run)
|
||||
|
||||
== setSeed rewinds an existing instance ==
|
||||
first draw before setSeed(7): 236, first draw after: 236
|
||||
|
||||
== Two outputs of an unseeded Random predict the third ==
|
||||
seen output 1 : 1471292627
|
||||
seen output 2 : 160425440
|
||||
predicted 3 : 239866061
|
||||
actual 3 : 239866061
|
||||
prediction correct: true
|
||||
Reference in New Issue
Block a user