RangeExtra 10^-20

davidl davidl at nospam.org
Sat May 9 04:07:19 PDT 2009


在 Sat, 25 Apr 2009 23:40:03 +0800,dsimcha <dsimcha at yahoo.com> 写道:

> == Quote from dsimcha (dsimcha at yahoo.com)'s article
>> == Quote from Simen Kjaeraas (simen.kjaras at gmail.com)'s article
>> > dsimcha wrote:
>> > > RangeExtra version 10^-20 is officially out.  It consists of a  
>> small and
>> > > hopefully growing number of ranges that didn't make it into the new
>> > > Phobos
>> > > that I've gotten working reasonably well and I feel eventually  
>> belong in
>> > > Phobos.
>> > >
>> > > Docs / What's there:
>> > > http://cis.jhu.edu/~dsimcha/rangeextra.html
>> > >
>> > > Code:
>> > >  
>> http://dsource.org/projects/scrapple/browser/trunk/rangeextra/rangeextra.d
>> > >
>> > > License:
>> > > Dual licensed, Phobos license or BSD (Tango style).
>> > I had hoped reindex would give me access to true 'random' access  
>> ranges, but it
>> seems this does not work:
>> >   auto b = reindex!( "uniform( 0, this.length )" )( [0,1,2,3,4].dup );
>> > :p
>
>> On the other hand, I really like the idea of a with-replacement random  
>> sampling
>> primitive.  This sounds like it belongs in RandomCover.  Maybe Andrei  
>> can extend
>> RandomCover (which already samples w/o replacement) to include a  
>> replacement
>> parameter.  RandomCover w/ replacement == false would do what it does  
>> now.  If
>> replacement == true, it would be an infinite range that samples with  
>> replacement.
>
> Here's a first attempt:  I took Andrei's RandomCover, fixed bug 2865  
> (This version
> of RandomCover passes basic statistical tests for uniformity of the  
> distribution
> over the permutation space), and added a template overload to allow  
> sampling with
> replacement.  It's under the Phobos license to make it as easy as  
> possible to add
> back to Phobos.  I'll file an enhancement request.
>
> http://dsource.org/projects/scrapple/browser/trunk/rangeextra/randomcover.d

Looking forward to it!

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/


More information about the Digitalmars-d-announce mailing list