Cannot create an instance of an abstract class (Random)
Just remove the parentheses: Random.nextInt(7)
.
Like this it uses the companion object (Default
) of class Random
which implements the abstract class Random
with a default behaviour.
From the documentation:
The companion object Random.Default is the default instance of Random