www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10900] New: Mersenne Twister should have a 64-bit (ulong) version

http://d.puremagic.com/issues/show_bug.cgi?id=10900

           Summary: Mersenne Twister should have a 64-bit (ulong) version
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: joseph.wakeling webdrake.net


--- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling webdrake.net>
2013-08-26 04:43:25 PDT ---
Boost.Random's Mersenne Twister implementation defines a 64-bit as well as
32-bit version:

#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T)
typedef mersenne_twister_engine<uint64_t,64,312,156,31,
    UINT64_C(0xb5026f5aa96619e9),29,UINT64_C(0x5555555555555555),17,
    UINT64_C(0x71d67fffeda60000),37,UINT64_C(0xfff7eee000000000),43,
    UINT64_C(6364136223846793005)> mt19937_64;
#endif

This should be ported to Phobos.

It will require some tweaks to the MersenneTwisterEngine design, as it takes
more template parameters than std.random's 32-bit version.  Compare Phobos,
with 11 different template parameters apart from the UIntType:

struct MersenneTwisterEngine(UIntType, size_t w, size_t n, size_t m, size_t r,
                             UIntType a, size_t u, size_t s,
                             UIntType b, size_t t,
                             UIntType c, size_t l)

with Boost (13 template parameters besides the UIntType):

template<class UIntType,
         std::size_t w, std::size_t n, std::size_t m, std::size_t r,
         UIntType a, std::size_t u, UIntType d, std::size_t s,
         UIntType b, std::size_t t,
         UIntType c, std::size_t l, UIntType f>
class mersenne_twister_engine

See: http://www.boost.org/doc/libs/1_54_0/boost/random/mersenne_twister.hpp

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 26 2013