RNG is a Scala trait for pure random number generation. Its nextInt method returns both a generated Int and a successor RNG, making state transitions explicit instead of mutating hidden memory. section 6.2
A caller retains control of the successor state while the generator implementation keeps its representation encapsulated. Reusing the same initial RNG therefore produces the same sequence, preserving referential transparency. section 6.2
Threading the successor generator
With SimpleRNG(42), the first call returns 16159453 and a new generator. Calling nextInt on that successor returns -1281479697. Passing the original generator again repeats the first result.
