Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5DE95931A for ; Fri, 3 Feb 2012 21:47:20 +0000 (UTC) Received: (qmail 7256 invoked by uid 500); 3 Feb 2012 21:47:19 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 6954 invoked by uid 500); 3 Feb 2012 21:47:19 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 6784 invoked by uid 99); 3 Feb 2012 21:47:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 21:47:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Feb 2012 21:47:16 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3278318C07D for ; Fri, 3 Feb 2012 21:46:55 +0000 (UTC) Date: Fri, 3 Feb 2012 21:46:55 +0000 (UTC) From: "Gilles (Updated) (JIRA)" To: issues@commons.apache.org Message-ID: <1171702336.9188.1328305615208.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <314388618.52707.1326898119959.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (MATH-734) Code cleanup: "ISAACRandom" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles updated MATH-734: ------------------------ Fix Version/s: (was: 3.0) 3.1 Postponing. Some of the same (non-blocking) issues apply to other RNG implementations; this can be discussed later. > Code cleanup: "ISAACRandom" > --------------------------- > > Key: MATH-734 > URL: https://issues.apache.org/jira/browse/MATH-734 > Project: Commons Math > Issue Type: Improvement > Reporter: Gilles > Assignee: Gilles > Priority: Minor > Fix For: 3.1 > > > In revision 1232899, I started to clean up the code (mainly, removing the one-letter instance variables, that can easily be confused with local ones within methods, making the code harder to understand and maintain). > Other points I'd want to handle: > * Should "Serializable" be implemented for such classes? I think not; especially if it supposed to be used for "secure" applications. > * (Related to the above) I'd remove the "transient" keyword. > * The contents of method "allocArrays" should be moved to within the constructor. > * It is not recommended to call non-final "public" methods ("setSeed") from within the constructor, because an overriding code could access a not fully initialized object. > * All initializations should take place within a single, most general, constructor and the other constructors should call that one (using the {{this(...)}} statement). > * This code (line 130) > {code} > if (seed == null) { > setSeed(System.currentTimeMillis() + System.identityHashCode(this)); > return; > } > {code} > should probably be removed: it is safer to consider passing a null reference as a user error. > * I'd remove the constructor taking a {{long}} argument. It is not obvious how the code will use the argument. I'd rather offer that alternative, in the class documentation, as an example of how to initialize the "array of integers" argument. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira