JVM

libraryDependencies += "com.avast" %% "sst-jvm" % "0.18.4"

Subproject sst-jvm provides pure implementations of different JVM-related utilities:

  • creation of thread pools,
  • standard in/out/err,
  • and random number generation.
import com.avast.sst.jvm.system.console.ConsoleModule
import com.avast.sst.jvm.system.random.RandomModule
import zio.interop.catz.*
import zio.Task
 
val program = for {
  random <- RandomModule.makeRandom[Task](1234L) // do not ever use seed like this!
  randomNumber <- random.nextInt
  console = ConsoleModule.make[Task]
  _ <- console.printLine(s"Random number: $randomNumber")
} yield ()

val runtime = zio.Runtime.default // this is just needed in example
runtime.unsafeRun(program)
// Random number: -1517918040