From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18988 invoked by alias); 11 May 2010 14:42:05 -0000 Received: (qmail 18936 invoked by uid 22791); 11 May 2010 14:42:03 -0000 X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_20,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 May 2010 14:41:54 +0000 Received: from localhost ([127.0.0.1]:50476 helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBqed-0005MR-4k; Tue, 11 May 2010 10:41:51 -0400 Date: Tue, 11 May 2010 14:42:00 -0000 Message-ID: <43fx1yilox.wl%bjg@gnu.org> From: Brian Gough To: Joseph Wakeling Cc: gsl-discuss@sourceware.org Subject: Re: Flat (uniform) random distribution and some development/contribution queries In-Reply-To: <4BE7EAAD.20603@webdrake.net> References: <4BE7EAAD.20603@webdrake.net> User-Agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2010-q2/txt/msg00014.txt.bz2 At Mon, 10 May 2010 13:14:53 +0200, Joseph Wakeling wrote: > While browsing the source code I noticed that the flat/uniform > distribution provided in GSL's randist.h provided only a 'half-open' > interval [a,b) akin to what gsl_rng_uniform() provides for [0,1) and not > also an 'open' interval (a,b) akin to what gsl_rng_uniform_pos() > provides for (0,1). > > So I wrote a couple of extra functions, which are attached as a git > patch in case they are useful/welcome. (Apologies if instead they are > stupid and I'm missing something; this is a very off-the-cuff > contribution, but it seemed easy enough to deliver and trivial enough to > not mind if it's rejected:-) Thanks, I will correct the comment. I don't think I will include the additional functions in this case as they are so similar to the existing ones. > More general development question, which is the main reason for joining > this list. A project I'm working on needs to employ random sampling on > several occasions: to be precise, the case of selecting n unique records > from the set {1, ..., N}, as described in these articles: > http://doi.acm.org/10.1145/358105.893 > http://doi.acm.org/10.1145/23002.23003 > http://doi.acm.org/10.1145/79505.356313 I think this is what gsl_ran_choose does. The implementation isn't as efficient as those described but it gives the same result. -- Brian Gough