score:2

Accepted answer

you can only call the method cumulativeprobability on an instance of class normaldistribution.

so, you will first have to create a normaldistribution object, and then call the method on that object. something like this:

val distr = new normaldistribution()
val prob = distr.cumulativeprobability(b)

i don't know what you mean by the new in this line:

val x = new (1 - cumulativeprobability(b))

but that's not valid syntax. you use the new operator to create a new object - i don't know what your intention was here.

score:1

first you need to make sure that the dependency is available to the project.

if for example your project is sbt-based, see http://www.scala-sbt.org/0.13/docs/library-management.html, if you use maven the story is pretty much the same.
once you update your project definition, you need to recreate project files for your intellij, i think you can use sbt-idea for sbt, and finally reimport the project. the support for maven should be integrated instead.

if you created your project directly in intellij without relying on these two then you need to add the jar dependency to your build path, see https://confluence.jetbrains.com/display/intellijidea/dependencies+management+%28build+path%29.

if the configuration is correct then you will see no red squiggle under the import statement for the library.

about the snippet, you should check what can you actually do with normaldistribution by checking the javadoc for it, i read you have some different constructors, by which you can configure your instance, for example setting a random generator explicitly.
when you get the instance you can call all of the public instance methods on it.


Related Query