February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | 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
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | 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&rep=rep1&type=pdf This seems like a nice article but I don't find a part relevant to this. Andrei | |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | 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 Equidistribution
Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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 http://www.pcg-random.org.
>> They claim to have both arbitrary period and k-Dimensional Equidistribution
>
> Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei
Dstep could be used to port the C++ version if needed.
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | 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 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 Equidistribution
>>
>> Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei
>
> Dstep could be used to port the C++ version if needed.
I don't think Dstep can handle C++.
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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 http://www.pcg-random.org. >> They claim to have both arbitrary period and k-Dimensional Equidistribution > > Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei Beat you to it: http://code.dlang.org/packages/d-pcg It only has the basic generators at the moment. I'll look into the more advanced stuff. (Also 64 bit outputs aren't implemented yet because they need a 128 bit uint for state. I noticed D reserves the names cent and ucent but hasn't implemented them) | |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Craig Dillabaugh | 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 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 Equidistribution
>>>
>>> Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei
>>
>> Dstep could be used to port the C++ version if needed.
>
> I don't think Dstep can handle C++.
Hmm. I thought that was what it did. Maybe I was thinking of another thing or perhaps I should make sure that I am not about to fall asleep before posting.
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicholas Wilson | 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 06:46 PM, Nicholas Wilson wrote:
>>>>> [...]
>>>>
>>>> Thanks, that's indeed closest! A hefty read. Anyone inclined to work on a PCG random implementation? -- Andrei
>>>
>>> Dstep could be used to port the C++ version if needed.
>>
>> I don't think Dstep can handle C++.
>
> Hmm. I thought that was what it did. Maybe I was thinking of another thing or perhaps I should make sure that I am not about to fall asleep before posting.
Dstep can convert C headers to D, but can't handle C++.
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Alex Parrill | 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 suggest taking a look at http://www.pcg-random.org.
>>> They claim to have both arbitrary period and k-Dimensional
>>> Equidistribution
>>
>> Thanks, that's indeed closest! A hefty read. Anyone inclined to work
>> on a PCG random implementation? -- Andrei
>
> Beat you to it: http://code.dlang.org/packages/d-pcg
>
> It only has the basic generators at the moment. I'll look into the more
> advanced stuff.
>
> (Also 64 bit outputs aren't implemented yet because they need a 128 bit
> uint for state. I noticed D reserves the names cent and ucent but hasn't
> implemented them)
That's pretty darn cool! I don't see a way to create a generator given a range expressed as a power of two. Say e.g. a client wants to say "give me a generator with a cycle of 32768". Is this easily doable?
Also: when the generator starts running, does it generate a full cycle, or it starts with a shorter cycle and then settle into a full cycle?
Thanks,
Andrei
| |||
February 26, 2016 Re: Pseudo-random numbers in [0, n), covering all numbers in n steps? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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 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
>>>> Equidistribution
>>>
>>> Thanks, that's indeed closest! A hefty read. Anyone inclined to work
>>> on a PCG random implementation? -- Andrei
>>
>> Beat you to it: http://code.dlang.org/packages/d-pcg
>>
>> It only has the basic generators at the moment. I'll look into the more
>> advanced stuff.
>>
>> (Also 64 bit outputs aren't implemented yet because they need a 128 bit
>> uint for state. I noticed D reserves the names cent and ucent but hasn't
>> implemented them)
>
> That's pretty darn cool! I don't see a way to create a generator given a range expressed as a power of two. Say e.g. a client wants to say "give me a generator with a cycle of 32768". Is this easily doable?
>
> Also: when the generator starts running, does it generate a full cycle, or it starts with a shorter cycle and then settle into a full cycle?
>
>
> Thanks,
>
> Andrei
My port at the moment only provides the basic pgm32 generators; their behavior should match the pgm32_* classes from the C++ library.
I'll look into which of the generators support the equidistributed results, though I suspect that they are distributed across the entire domain of the result type.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply