View mode: basic / threaded / horizontal-split · Log in · Help
July 21, 2012
Re: std.random and mersenne twister
On Saturday, 21 July 2012 at 10:28:58 UTC, monarch_dodra wrote:
> I'd just have to wait to finish my current development (I don't 
> know how to have parallel forks).

Just create a single GitHub fork with multiple branches, one for 
each feature/bug you are working on. After pushing them to 
GitHub, you can create separate pull requests for each of them.

David
July 21, 2012
Re: std.random and mersenne twister
On 7/21/12 6:28 AM, monarch_dodra wrote:
> On Friday, 20 July 2012 at 21:45:17 UTC, Andrei Alexandrescu wrote:
>> On 7/20/12 8:51 AM, Andrea Fontana wrote:
>>> CMWC is proven to be a valid method and it passes diehard tests. It was
>>> written by prof. George Marsiglia (he developed xorshift too - included
>>> in std.random). He was one of the best experts in PRNG.
>>
>> Would be great if you wanted to contribute an implementation of CMWC
>> to std.random.
>>
>> Thanks,
>>
>> Andrei
>
> That's something I could undertake confidently.
>
> Writing both an actual engine, and creating aliases for pre-optimized
> schemes.
>
> I'd just have to wait to finish my current development (I don't know how
> to have parallel forks).

That would be awesome (both RNG and getting fluent with parallel forks).

Andrei
July 24, 2012
Re: std.random and mersenne twister
On Saturday, 21 July 2012 at 16:32:56 UTC, Andrei Alexandrescu 
wrote:
> On 7/21/12 6:28 AM, monarch_dodra wrote:
>> On Friday, 20 July 2012 at 21:45:17 UTC, Andrei Alexandrescu 
>> wrote:
>>> On 7/20/12 8:51 AM, Andrea Fontana wrote:
>>>> CMWC is proven to be a valid method and it passes diehard 
>>>> tests. It was
>>>> written by prof. George Marsiglia (he developed xorshift too 
>>>> - included
>>>> in std.random). He was one of the best experts in PRNG.
>>>
>>> Would be great if you wanted to contribute an implementation 
>>> of CMWC
>>> to std.random.
>>>
>>> Thanks,
>>>
>>> Andrei
>>
>> That's something I could undertake confidently.
>>
>> Writing both an actual engine, and creating aliases for 
>> pre-optimized
>> schemes.
>>
>> I'd just have to wait to finish my current development (I 
>> don't know how
>> to have parallel forks).
>
> That would be awesome (both RNG and getting fluent with 
> parallel forks).
>
> Andrei

I gave it a shot, but I just couldn't find enough documentation 
on CMWC to write a correctly parametrizable engine. I honestly 
don't have much to go by other than wikipedia's example. I could 
force the implementation, but I'd have zero faith in it's 
reliability.

That said, I don't think it would be a bad idea to add a Lagged 
Fibonacci generator first. The generator already exists in boost, 
and is much more documented. The actual development would just 
require a port.

I'll try to get *that* done, but for CMWC, I'm out. Sorry.

The bright side is I learned to parallel fork :D
July 24, 2012
Re: std.random and mersenne twister
On Tuesday, 24 July 2012 at 16:09:15 UTC, monarch_dodra wrote:
> On Saturday, 21 July 2012 at 16:32:56 UTC, Andrei Alexandrescu 
> wrote:
>> On 7/21/12 6:28 AM, monarch_dodra wrote:
>>> On Friday, 20 July 2012 at 21:45:17 UTC, Andrei Alexandrescu 
>>> wrote:
>>>> On 7/20/12 8:51 AM, Andrea Fontana wrote:
>>>>> CMWC is proven to be a valid method and it passes diehard 
>>>>> tests. It was
>>>>> written by prof. George Marsiglia (he developed xorshift 
>>>>> too - included
>>>>> in std.random). He was one of the best experts in PRNG.
>>>>
>>>> Would be great if you wanted to contribute an implementation 
>>>> of CMWC
>>>> to std.random.
>>>>
>>>> Thanks,
>>>>
>>>> Andrei
>>>
>>> That's something I could undertake confidently.
>>>
>>> Writing both an actual engine, and creating aliases for 
>>> pre-optimized
>>> schemes.
>>>
>>> I'd just have to wait to finish my current development (I 
>>> don't know how
>>> to have parallel forks).
>>
>> That would be awesome (both RNG and getting fluent with 
>> parallel forks).
>>
>> Andrei
>
> I gave it a shot, but I just couldn't find enough documentation 
> on CMWC to write a correctly parametrizable engine. I honestly 
> don't have much to go by other than wikipedia's example. I 
> could force the implementation, but I'd have zero faith in it's 
> reliability.
>
> That said, I don't think it would be a bad idea to add a Lagged 
> Fibonacci generator first. The generator already exists in 
> boost, and is much more documented. The actual development 
> would just require a port.
>
> I'll try to get *that* done, but for CMWC, I'm out. Sorry.
>
> The bright side is I learned to parallel fork :D

I see there's an implementation in tango for d1, with params too 
:)
Have you looked for Marsaglia's paper?
July 24, 2012
Re: std.random and mersenne twister
On Wednesday, July 25, 2012 00:01:03 Andrea Fontana wrote:
> I see there's an implementation in tango for d1, with params too

Which does Phobos no good unless you can get permission from the author(s) of 
that code to switch the license to Boost. Without that, you should probably 
avoid even looking at it if you're going to be working on an implementation 
for it so that you eliminate any risk of licensing issues. There's a lot of 
great work which went into Tango, but as long as its license is incompatible 
with Boost, it can't be put into Phobos at all, though it can still obviously 
be used by those who want to (especially now that there's a D2 fork of Tango).

- Jonathan M Davis
July 25, 2012
Re: std.random and mersenne twister
He want docs, here he can understand how it works. 

Some good params for CMWC can be found here and was provided by G.
Marsaglia:
http://blacklen.wordpress.com/2011/05/15/prng-3-complementary-multiply-with-carry/

A code for java "you're free to use this code as you want" can be find
here:
http://www.javaprogrammingforums.com/blogs/helloworld922/11-complimentary-multiply-carry-better-way-generate-pseudo-random-numbers.html

Here some code and overview from george marsaglia:
http://school.anhb.uwa.edu.au/personalpages/kwessen/shared/Marsaglia03.html

Some considerations:
http://www.powerbasic.com/support/pbforums/showthread.php?t=50216


Il giorno mar, 24/07/2012 alle 18.18 -0400, Jonathan M Davis ha scritto:

> On Wednesday, July 25, 2012 00:01:03 Andrea Fontana wrote:
> > I see there's an implementation in tango for d1, with params too
> 
> Which does Phobos no good unless you can get permission from the author(s) of 
> that code to switch the license to Boost. Without that, you should probably 
> avoid even looking at it if you're going to be working on an implementation 
> for it so that you eliminate any risk of licensing issues. There's a lot of 
> great work which went into Tango, but as long as its license is incompatible 
> with Boost, it can't be put into Phobos at all, though it can still obviously 
> be used by those who want to (especially now that there's a D2 fork of Tango).
> 
> - Jonathan M Davis
July 25, 2012
Re: std.random and mersenne twister
Thanks for the links, and the info regarding copyrights. I'll 
stick with my decision to *start* with Lagged Fibonacci. I'll let 
the experience of that decide for me if I want to tackle CMWC or 
not (provided I even succeed with LF).

PS: I like the name Marsaglia Tornado, but the initials are mt...
July 25, 2012
Re: std.random and mersenne twister
Of course it was a joke :)

Il giorno mer, 25/07/2012 alle 10.41 +0200, monarch_dodra ha scritto:

> PS: I like the name Marsaglia Tornado, but the initials are mt...
July 30, 2012
Re: std.random and mersenne twister
On Tuesday, 24 July 2012 at 16:09:15 UTC, monarch_dodra wrote:
> That said, I don't think it would be a bad idea to add a Lagged 
> Fibonacci generator first. The generator already exists in 
> boost, and is much more documented. The actual development 
> would just require a port.

Hi There!

I wrote the port.
https://github.com/D-Programming-Language/phobos/pull/727

It works as intended, AFAIK, as it generates the exact same 
sequence that boost does.

I'd be mighty pleased to have code review done on it.

The details are on the pull page, but I guess you can also leave 
some feedback here.
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home