Dispatching is one of Julia’s strong suits. I was wondering, is there a single function which would generate a

random element based on a given probability distribution function, a random number genarator and a given element interval? I’m using Julia 0.7. If not, what are your suggestions?

I’m talking about something similar to the fit_mle(D, x, w) method in the DIstribution.jl.

`Distributions.fit_mle`

— Method.`fit_mle(D, x, w)`

Fit a distribution of type

`D`

to a weighted data set`x`

, with weights given by`w`

.Here,

`w`

should be an array with length`n`

, where`n`

is the number of samples contained in`x`

.## Applicable distributions

The

`fit_mle`

method has been implemented for the following distributions:

Univariate:

`Bernoulli`

`Beta`

`Binomial`

`Categorical`

`DiscreteUniform`

`Exponential`

`Normal`

`Gamma`

`Geometric`

`Laplace`

`Pareto`

`Poisson`

`Uniform`

Multivariate: