Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 62316 invoked from network); 17 Nov 2010 08:38:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Nov 2010 08:38:35 -0000 Received: (qmail 14015 invoked by uid 500); 17 Nov 2010 08:39:06 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 13779 invoked by uid 500); 17 Nov 2010 08:39:06 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 13771 invoked by uid 99); 17 Nov 2010 08:39:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Nov 2010 08:39:05 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ted.dunning@gmail.com designates 74.125.82.171 as permitted sender) Received: from [74.125.82.171] (HELO mail-wy0-f171.google.com) (74.125.82.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Nov 2010 08:38:57 +0000 Received: by wyb39 with SMTP id 39so1635141wyb.30 for ; Wed, 17 Nov 2010 00:38:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=V9puf4YXmknW287Bm79CLYHTwVGEFswCLFe/ie6rQoo=; b=Ga4Lq88fKp3HvcMFiIEZjABjLSOdO3Uu7wdkcxFKMmzBqEI6xSk2i9tn1asuMGFVaK pH0ek28wbacG41xejyZl9XP1kkzJfPYe7Mlw3irtCTi3/vTvpWu7F28e+w+OxR7OVeoy vtKb4LwY4FwgEn59mY4pa5/mi1OExdsoJ8+zg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=h/Y4SpTCJI91HttQmrDKPVZo8CxEP+qQN4Zxw5na68MivIhg6JcaE7eIlBWqSeacUv HtgLGjGzUpKIXjMM1LcaQu4BiAgbqpgm5YfuzC3COcJSOxyt7R91HOA1BCJMEVH6QuK4 vgxwjd4xDMV/Go3zOTB/7d32cYkWRQHslY9Gc= Received: by 10.216.82.197 with SMTP id o47mr8386416wee.45.1289983116757; Wed, 17 Nov 2010 00:38:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.175.5 with HTTP; Wed, 17 Nov 2010 00:38:16 -0800 (PST) In-Reply-To: <4CE38FFB.70008@free.fr> References: <4CE2F49A.6030208@free.fr> <4CE38FFB.70008@free.fr> From: Ted Dunning Date: Wed, 17 Nov 2010 00:38:16 -0800 Message-ID: Subject: Re: [math] inconsistent use of random generators To: Commons Developers List Content-Type: multipart/alternative; boundary=001636eefd2a70cc8b04953b99ac X-Virus-Checked: Checked by ClamAV on apache.org --001636eefd2a70cc8b04953b99ac Content-Type: text/plain; charset=UTF-8 On Wed, Nov 17, 2010 at 12:19 AM, Luc Maisonobe wrote: > > In Mahout, we did this by having a static method in a utility class for > > getting a standard generator for either testing or normal operation. > This > > has turned out very well. > > It's a very good idea for production code, but I am not sure I > understand it's use for test code. Doesn't that induce problems when new > tests are included which change the running order of the tests or when > only one test is run ? No. The seed is constant. This means that the test gets the same results no matter what. Moreover, since the generator is obtained in the same way, and it is the utility method that checks to see if a test is being run, exactly the same production code paths are exercised in production and test mode. > In these cases the current state for the > generator will not be the same in each situation. Do tests reseed the > generator when they start ? > The utility returns a consistently seeded generator if running a test. The code using the generator just asks the utility class for a generator and doesn't know if it is seeded for a test or not. --001636eefd2a70cc8b04953b99ac--