| Thread overview | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 20, 2016 Normal distribution | ||||
|---|---|---|---|---|
| ||||
Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei | ||||
February 20, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: > Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei There is one in dstats: https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266 | |||
February 20, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| Maybe not good quality, but I like this one for my ludic purposes: https://github.com/lmbarros/sbxs_dlang/blob/master/src/sbxs/rand/rng.d#L283 It is an implementation of an approximation algorithm that used to be described here: http://home.online.no/~pjacklam/notes/invnorm/ But appears to be offline right now. On the Wayback Machine: http://web.archive.org/web/20151030212409/http://home.online.no/~pjacklam/notes/invnorm <http://web.archive.org/web/20151030212409/http://home.online.no/~pjacklam/notes/invnorm> LMB On Sat, Feb 20, 2016 at 12:01 PM, Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com> wrote: > Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei > | |||
February 20, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: > Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei Not sure if good quality but: https://d-gamedev-team.github.io/gfm/gfm.math.simplerng.html | |||
February 20, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: > Do we have a good quality converter of uniform numbers to Gaussian-distributed numbers around? -- Andrei There is this, from years ago: https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266 and the range wrappers also in that module. There is also of course https://github.com/WebDrake/hap/blob/master/source/hap/random/distribution.d#L507 But as you will remember from many messages from Joseph Rushton Wakeling, he's been blocked by difficulties with the range API, which also apply to the dstats version. | |||
February 20, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 20.02.2016 15:01, Andrei Alexandrescu wrote: > Do we have a good quality converter of uniform numbers to > Gaussian-distributed numbers around? -- Andrei I don't know about quality, but the following is in Phobos: https://dlang.org/phobos/std_mathspecial.html#.normalDistributionInverse | |||
February 26, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Edwin van Leeuwen | On 02/20/2016 09:06 AM, Edwin van Leeuwen wrote:
> On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote:
>> Do we have a good quality converter of uniform numbers to
>> Gaussian-distributed numbers around? -- Andrei
>
> There is one in dstats:
> https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266
Thanks! I ended up using this. Is someone working on adding Gaussians to phobos? -- Andrei
| |||
February 26, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Friday, 26 February 2016 at 18:23:41 UTC, Andrei Alexandrescu wrote: > On 02/20/2016 09:06 AM, Edwin van Leeuwen wrote: >> On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: >>> Do we have a good quality converter of uniform numbers to >>> Gaussian-distributed numbers around? -- Andrei >> >> There is one in dstats: >> https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266 > > Thanks! I ended up using this. Is someone working on adding Gaussians to phobos? -- Andrei https://github.com/WebDrake/hap is intended as a replacement for std.random and includes distributions (see e.g. https://github.com/WebDrake/hap/blob/master/source/hap/random/distribution.d#L441). Also, remember http://dconf.org/2015/talks/wakeling.html | |||
February 26, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to John Colvin | On Friday, 26 February 2016 at 19:11:15 UTC, John Colvin wrote: > On Friday, 26 February 2016 at 18:23:41 UTC, Andrei Alexandrescu wrote: >> On 02/20/2016 09:06 AM, Edwin van Leeuwen wrote: >>> On Saturday, 20 February 2016 at 14:01:22 UTC, Andrei Alexandrescu wrote: >>>> Do we have a good quality converter of uniform numbers to >>>> Gaussian-distributed numbers around? -- Andrei >>> >>> There is one in dstats: >>> https://github.com/DlangScience/dstats/blob/master/source/dstats/random.d#L266 >> >> Thanks! I ended up using this. Is someone working on adding Gaussians to phobos? -- Andrei > > https://github.com/WebDrake/hap is intended as a replacement for std.random and includes distributions (see e.g. https://github.com/WebDrake/hap/blob/master/source/hap/random/distribution.d#L441). Also, remember http://dconf.org/2015/talks/wakeling.html Yup. The basic problem of getting this stuff into phobos are the architectural problems discussed in that talk. Unlike uniform distribution (which is straightforward to implement as a function, no questions asked), the normal distribution is best implemented as a range which keeps some state. So the reference-type/non-reference-type issues start becoming a factor. That said, it's _possible_ to implement a simple normal-variate-generator as a function, it's just inefficient. | |||
February 26, 2016 Re: Normal distribution | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On 2/26/16 2:32 PM, Joseph Rushton Wakeling wrote:
> Yup. The basic problem of getting this stuff into phobos are the
> architectural problems discussed in that talk. Unlike uniform
> distribution (which is straightforward to implement as a function, no
> questions asked), the normal distribution is best implemented as a range
> which keeps some state. So the reference-type/non-reference-type issues
> start becoming a factor.
Would it work to define Gaussian generators as regular generators (same as the existing ones), which keep the uniform engine as a member? -- Andrei
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply