RE: Non-uniform randomness in Erlang? (as a feature)

Sergey Prokhorov <[email protected]> Tue, 25 Jan 2022 14:56:45 +0100
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAMZozm7FNF7_7iyVjFC-M+_aHE7=AmMxNddzbyeXeniWYVU5vg@mail.gmail.com>
Hi,

I'm not sure I fully understand the terminology, but did I understand
correctly that you are looking for some "random choice with weights"?

I have implemented the "walker alias" algorithm some time ago
https://gist.github.com/seriyps/5593193
But it is more or less a direct translation from imperative code, so it
does not look really idiomatic.
And it also only returns values from a predefined finite set, not via
arbitrary density function.


> Hi,
>
> A bit in link with the recent message of Kenji regarding
> state-of-the-art random generators: if needing to draw samples from,
> this time, a specific, non-uniform distribution, are there Erlang
> libraries able to accept as input such a user-specified, arbitrary
> probability density function?
>
> (I searched for "Inverse transform sampling in Erlang" and alike, yet,
> because of the statistical distribution of the same name, pointers are
> difficult to find)
>
> Thanks in advance for any information,
>
> Best regards,
>
> Olivier.
>
> --
>
> Olivier Boudeville