Unresolved reference: random()

Hello, I’am a beginner, I try to make an exercice from [developer.android] but I’m facing an issue.
here is my code

class Dice (private val numSides: Int) {

   fun roll(): Int{
       return (1..numSides).random()
   }
}

it shows me : Unresolved reference: random()
please help me
thank you!

Try importing kotlin.ranges.random. I don’t think it’ll fix it (since I think the function should be imported automatically), but it might tell you something. Like you might be missing a dependency on the kotlin stdlib