Cannot get DoubleArray.shuffle() to work in IntelliJ

I have the following lines of code which work in the online Kotlin playgound provided that I set the language version to 1.4, since that is when the shuffle function was added for DoubleArray.

val seq = DoubleArray(11){it * 0.1}

However, the same code fails in IntelliJ. I set the language version to 1.4 in the project settings, and the line
println("Version : ${KotlinVersion.CURRENT}")
tells me that I am in fact using version 1.4.20. I also am able to use a trailing comma at the end of a parameter list, which is supposed to work only in version 1.4. Therefore I don’t understand why code that works on the playground won’t work in my IDE.

The error message from the complier is about receiver type mismatch, and lists uses of shuffle for MutableLists (and only MutableList) that make it appear that the compiler is not aware of DoubleArray.shuffle.

Thanks in advance to anyone who can help me understand the problem.

Ensure that not only the language version is set to 1.4, but the API version too.
Also ensure that you have the correct version of the standard library in your module dependencies. You can check that in the “Project structure” dialog on the “Modules” tab.

1 Like

The API change did it. Many thanks.