Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Andrei Alexandrescu via Digitalmars-d
On 02/26/2016 04:57 PM, H. S. Teoh via Digitalmars-d wrote: On Fri, Feb 26, 2016 at 09:26:54PM +, Joseph Rushton Wakeling via Digitalmars-d wrote: On Friday, 26 February 2016 at 12:21:11 UTC, Andrei Alexandrescu wrote: On 02/26/2016 03:05 AM, Joseph Rushton Wakeling wrote: I can probably

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 23:05:00 UTC, John Colvin wrote: This was what I was trying to get at in my initial post, but I failed to get the idea across properly. Yea. It didn't even click with me at first, because when I first read Andrei's email I jumped straight in my head to the

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread John Colvin via Digitalmars-d
On Friday, 26 February 2016 at 19:35:38 UTC, Joseph Rushton Wakeling wrote: On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: This could be fixed by devising a PRNG that takes a given period n and generates all numbers in [0, n) in exactly n steps. On reflection, I

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread H. S. Teoh via Digitalmars-d
On Fri, Feb 26, 2016 at 09:26:54PM +, Joseph Rushton Wakeling via Digitalmars-d wrote: > On Friday, 26 February 2016 at 12:21:11 UTC, Andrei Alexandrescu wrote: > >On 02/26/2016 03:05 AM, Joseph Rushton Wakeling wrote: > >>I can probably find the PRs if you want to see the context. > > > >I

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 12:21:11 UTC, Andrei Alexandrescu wrote: On 02/26/2016 03:05 AM, Joseph Rushton Wakeling wrote: I can probably find the PRs if you want to see the context. I understand the motivation behind that statement, and am not worried about pointing fingers etc. Would

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 12:23:24 UTC, Andrei Alexandrescu wrote: On 02/26/2016 03:34 AM, Joseph Rushton Wakeling wrote: http://apfelmus.nfshost.com/articles/random-permutations.html This touches the input, we just want to cover it. I thought the whole point of that article was that

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 12:23:24 UTC, Andrei Alexandrescu wrote: On 02/26/2016 03:34 AM, Joseph Rushton Wakeling wrote: http://apfelmus.nfshost.com/articles/random-permutations.html This touches the input, we just want to cover it.

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: This could be fixed by devising a PRNG that takes a given period n and generates all numbers in [0, n) in exactly n steps. On reflection, I have a nasty feeling there's a fundamental problem with this proposed approach.

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Alex Parrill via Digitalmars-d
On Friday, 26 February 2016 at 16:45:53 UTC, Andrei Alexandrescu wrote: On 02/26/2016 10:19 AM, Alex Parrill wrote: On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Andrei Alexandrescu via Digitalmars-d
On 02/26/2016 10:19 AM, Alex Parrill wrote: On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you describe is k-Dimensional Equidistribution (in this case k=1). I would

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Craig Dillabaugh via Digitalmars-d
On Friday, 26 February 2016 at 15:21:08 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 15:17:16 UTC, Craig Dillabaugh wrote: On Friday, 26 February 2016 at 15:15:11 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Nicholas Wilson via Digitalmars-d
On Friday, 26 February 2016 at 15:17:16 UTC, Craig Dillabaugh wrote: On Friday, 26 February 2016 at 15:15:11 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Alex Parrill via Digitalmars-d
On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you describe is k-Dimensional Equidistribution (in this case k=1). I would suggest taking a look at

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Craig Dillabaugh via Digitalmars-d
On Friday, 26 February 2016 at 15:15:11 UTC, Nicholas Wilson wrote: On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you describe is k-Dimensional Equidistribution (in

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Nicholas Wilson via Digitalmars-d
On Friday, 26 February 2016 at 14:59:43 UTC, Andrei Alexandrescu wrote: On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you describe is k-Dimensional Equidistribution (in this case k=1). I would suggest taking a look at

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Andrei Alexandrescu via Digitalmars-d
On 02/25/2016 06:46 PM, Nicholas Wilson wrote: The technical name for the property of distribution you describe is k-Dimensional Equidistribution (in this case k=1). I would suggest taking a look at http://www.pcg-random.org. They claim to have both arbitrary period and k-Dimensional

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Andrei Alexandrescu via Digitalmars-d
On 02/26/2016 03:34 AM, Joseph Rushton Wakeling wrote: http://apfelmus.nfshost.com/articles/random-permutations.html This touches the input, we just want to cover it. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.150.9347=rep1=pdf This seems like a nice article but I don't find

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Andrei Alexandrescu via Digitalmars-d
On 02/26/2016 03:05 AM, Joseph Rushton Wakeling wrote: I can probably find the PRs if you want to see the context. I understand the motivation behind that statement, and am not worried about pointing fingers etc. Would be great if a new PR removed the text. -- Andrei

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 08:05:09 UTC, Joseph Rushton Wakeling wrote: On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 08:05:09 UTC, Joseph Rushton Wakeling wrote: On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 08:12:18 UTC, Joseph Rushton Wakeling wrote: On Friday, 26 February 2016 at 08:05:09 UTC, Joseph Rushton Wakeling wrote: On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Friday, 26 February 2016 at 08:05:09 UTC, Joseph Rushton Wakeling wrote: On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-26 Thread Joseph Rushton Wakeling via Digitalmars-d
On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the array already covered. Yes, this is definitely a standout in terms of being

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-25 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the array already covered. This could be fixed by devising a PRNG that takes a

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-25 Thread tn via Digitalmars-d
On Thursday, 25 February 2016 at 18:19:56 UTC, John Colvin wrote: I don't know of an algorithm for generating random permutations that isn't in-place (or O(N) storage), but I'm not an expert on the topic so maybe one does exist. These might be relevant:

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-25 Thread Andrei Alexandrescu via Digitalmars-d
On 02/25/2016 01:19 PM, John Colvin wrote: I don't think that's a good idea. A prng is closed path through a state space and it doesn't matter where you start on said path, you're going to follow the same closed path through the state space. That's totally fine for some applications - those

Re: Pseudo-random numbers in [0, n), covering all numbers in n steps?

2016-02-25 Thread John Colvin via Digitalmars-d
On Thursday, 25 February 2016 at 17:27:25 UTC, Andrei Alexandrescu wrote: So we have https://dlang.org/phobos/std_random.html#.randomCover which needs to awkwardly allocate memory to keep track of the portions of the array already covered. This could be fixed by devising a PRNG that takes a