Julia version
Julia 1.0.5
What I want to do:
I want to draw a random sample from a continuous uniform distribution, U[10, 50].
A way to do it in Julia
The following works:
import Distributions
unifdist = Distributions.Uniform(10, 50)
sample_size_1 = Distributions.rand(unifdist)
sample_size_5 = Distributions.rand(unifdist, 5)
Question
If I run methods(Distributions.rand)
150 methods come up. Searching for Uniform brings up:
rand(rng::Random.AbstractRNG, d::Distributions.Uniform)
What I don’t understand is that why the above code example works when I am not passing the first argument. It does not show up as optional in this list of methods. I also searched in the list of methods for the term UnivariateDistribution
, thinking that UniformDistribution is a subtype of UnivariateDistribution
. But there is no method that comes up that shows rng
as optional, or even shows that the number of sampled observations can be entered as an optional argument.
What am I missing? How could I have figured from the documentation (or methods list) that the above code examples are possible?
Thank you. I appreciate your help.