Thread overview
Random distributions in Phobos
Apr 26, 2012
Jesse Phillips
Apr 26, 2012
Jesse Phillips
Apr 26, 2012
Jonathan M Davis
April 25, 2012
Hello all,

Currently Phobos only implements the uniform distribution for random number generation.  It should be relatively trivial to extend that to other distributions (exponential, normal, Pareto, ...), so I'm considering putting together some code.

Before I start writing, though: are there any standards or specifications that are being followed in constructing these kinds of mathematical functions for Phobos?

Thanks & best wishes,

    -- Joe
April 26, 2012
On Wednesday, 25 April 2012 at 01:03:39 UTC, Joseph Rushton Wakeling wrote:
> Hello all,
>
> Currently Phobos only implements the uniform distribution for random number generation.  It should be relatively trivial to extend that to other distributions (exponential, normal, Pareto, ...), so I'm considering putting together some code.
>
> Before I start writing, though: are there any standards or specifications that are being followed in constructing these kinds of mathematical functions for Phobos?
>
> Thanks & best wishes,
>
>     -- Joe

I suppose it would make sense for these to make it into phobos, personally am not familiar with the use case.

Instead of writing the answer to your question here, I've made changes to the wiki. I think there is a page I'm missing but don't know where it is so maybe someone else will correct it:

http://www.prowiki.org/wiki4d/wiki.cgi?HelpDProgress#ContributingtoPhobos
April 26, 2012
On 26/04/12 06:03, Jesse Phillips wrote:
> I suppose it would make sense for these to make it into phobos, personally am
> not familiar with the use case.

The use case is mostly to do with scientific simulation: if you look at most science-oriented languages and libraries (MATLAB/Octave, R, GNU Scientific Library, ...) they offer an extensive range of different random number distributions.

SciD would also be an acceptable location for this kind of functionality, but going by the example of e.g. Boost.Random it seems appropriate to have the basic RNG functionality coupled with extra distributions.  It's also clear from the std.random documentations that more distributions are planned for inclusion.

> Instead of writing the answer to your question here, I've made changes to the
> wiki. I think there is a page I'm missing but don't know where it is so maybe
> someone else will correct it:
>
> http://www.prowiki.org/wiki4d/wiki.cgi?HelpDProgress#ContributingtoPhobos

OK, thanks.  So to be clear: I should submit my proposed changes as a pull request, making sure to include a and should expect feedback after about 2 weeks ... ?

I ask because I wasn't clear if I'd done the right thing when I submitted a pull request on my random sampling functionality.  I was expecting to get at least an acknowledgement quite quickly, either saying that the code would be looked at or highlighting an obvious missing factor (e.g. appropriate unittests or benchmarks).

Thanks & best wishes,

    -- Joe
April 26, 2012
On Thursday, April 26, 2012 13:46:20 Joseph Rushton Wakeling wrote:
> On 26/04/12 06:03, Jesse Phillips wrote:
> > I suppose it would make sense for these to make it into phobos, personally am not familiar with the use case.
> 
> The use case is mostly to do with scientific simulation: if you look at most science-oriented languages and libraries (MATLAB/Octave, R, GNU Scientific Library, ...) they offer an extensive range of different random number distributions.
> 
> SciD would also be an acceptable location for this kind of functionality, but going by the example of e.g. Boost.Random it seems appropriate to have the basic RNG functionality coupled with extra distributions. It's also clear from the std.random documentations that more distributions are planned for inclusion.
> > Instead of writing the answer to your question here, I've made changes to the wiki. I think there is a page I'm missing but don't know where it is so maybe someone else will correct it:
> > 
> > http://www.prowiki.org/wiki4d/wiki.cgi?HelpDProgress#ContributingtoPhobos
> 
> OK, thanks. So to be clear: I should submit my proposed changes as a pull request, making sure to include a and should expect feedback after about 2 weeks ... ?
> 
> I ask because I wasn't clear if I'd done the right thing when I submitted a pull request on my random sampling functionality. I was expecting to get at least an acknowledgement quite quickly, either saying that the code would be looked at or highlighting an obvious missing factor (e.g. appropriate unittests or benchmarks).

No. The whole "2 weeks" thing is talking about the review process for adding major new functionality to Phobos (e.g. adding a new module). Major stuff needs to be reviewed and voted in on the newsgroup per the Boost review process (or something approximating it anyway). After something has been reviewed and voted it, then it goes through the normal pull request process to actually get merged into Phobos.

Smaller stuff (e.g. fixing a bug or adding one function) can go through the pull request process without a review in the newsgroup (the Phobos devs will normally point it out if something is major enough to need full review if you're not sure).

However, there is no guarantee whatsoever about how quickly a pull request will be processed. Sometimes, it's very quick. Other times, a pull request can sit there for a while before it gets looked at. The Phobos devs are all volunteers working in their own time, and there are only so many of them, so when they get to pull requests tends to be very dependent on their personal schedules and on what the pull request is for (e.g. if it's for something that a particular developer works on regularly or it's very simple, it's much more likely to be processed quickly, but if it's more esoteric and/or large and complicated, then it's much more likely to take a while).

- Jonathan M Davis
April 26, 2012
On Thursday, 26 April 2012 at 11:46:32 UTC, Joseph Rushton Wakeling wrote:
> OK, thanks.  So to be clear: I should submit my proposed changes as a pull request, making sure to include a and should expect feedback after about 2 weeks ... ?

Good follow up, I actually forgot about the three types of submissions and yours being the second (bugs third).

The review processes is really for major additions or changes. You are suggesting an expansion on existing functionality.

In which case submission via a pull request before review is acceptable, the review is done by the Phobos maintainers instead of requiring whole community input. However once you have a pull request ready, I think it is good to post to the forum to give it more visibility.

I also think adding a bugzilla entry for the enhancement may also be welcomed (other opinions?). The pull request would then state it closes the bug.

http://d.puremagic.com/issues/

As for response expectations, there can't really be. There is a good chance things will sit in the queue for some time, if it takes too long, then asking again I don't see as being frowned upon.