RosettaCodeData/Task/Random-number-generator-device-/Scala/random-number-generator-device-.scala
2023-07-01 13:44:08 -04:00

9 lines
301 B
Scala

import java.security.SecureRandom
object RandomExample extends App {
new SecureRandom {
val newSeed: Long = this.nextInt().toLong * this.nextInt()
this.setSeed(newSeed) // reseed using the previous 2 random numbers
println(this.nextInt()) // get random 32-bit number and print it
}
}