[phobos] fastDice
Masahiro Nakagawa
repeatedly at gmail.com
Sun Jan 2 17:30:45 PST 2011
OK. I will add in the weekend.
Masahiro
On Mon, 03 Jan 2011 10:11:30 +0900, Andrei Alexandrescu
<andrei at erdani.com> wrote:
> That looks addable to Phobos immediately. You may want to just add it
> when you have the time.
>
> Andrei
>
> On 1/2/11 6:37 PM, Masahiro Nakagawa wrote:
>> I want more generators.
>> MinstdRand is lightweight but poor.
>> MT is good period but very large.
>>
>> I often use Xorshift(128bit) generator.
>> https://bitbucket.org/repeatedly/scrap/src/0d5acf2d18f4/xorshift.d
>>
>> Of course, Boost.Random has other various generators.
>>
>>
>> Masahiro
>>
>> On Mon, 03 Jan 2011 07:59:29 +0900, Andrei Alexandrescu
>> <andrei at erdani.com> wrote:
>>
>>> On 9/11/10 3:29 PM, David Simcha wrote:
>>>> I've written a few functions that generate random numbers from an
>>>> arbitrary discrete distribution in O(log N) time, where N is the
>>>> number
>>>> of possible values, using SortedRange.lowerBound(). It's similar to
>>>> dice() except that in exchange for O(N) auxiliary space and upfront
>>>> initialization cost you get O(log N) generation. I've attached the
>>>> code,
>>>> which is fairly simple. Should this go in std.random, or is needing
>>>> this
>>>> O(log N) performance on dice() niche enough that this belongs in my
>>>> dstats lib instead?
>>>
>>> I'm not sure. You may want to ask the question on the newsgroup.
>>>
>>> BTW, I think std.random is in dire need of a few classic distribution
>>> (Gaussian, Poisson, Zipf come to mind). Anyone inclined?
>>>
>>>
>>> Andrei
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list