https://kotlinlang.org logo
Title
b

Barend

10/29/2018, 8:27 PM
I can't use
kotlin.random.Random
... what's up with that?
o

orangy

10/29/2018, 8:27 PM
“Can’t use” is a little bit unspecific. What exactly is happening?
b

Barend

10/29/2018, 8:29 PM
I'm trying to use it like this:
import android.graphics.Color
import kotlin.random.Random

private val randomInt = { Random.nextInt(256) }

internal fun getRandomColor(): Int {
    val r = randomInt()
    val g = randomInt()
    val b = randomInt()

    return Color.rgb(r, g, b)
}
but Gradle gives an error:
Unresolved reference random
and
Unresolved reference Random
.
o

orangy

10/29/2018, 8:34 PM
Do you have proper stdlib version in dependencies? Check in the Gradle window.
b

Barend

10/29/2018, 8:41 PM
It was set to '1.2.71' 😅, setting it to '1.3.0' worked
Now I've got some other issues to dig in to