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 8E28A1859D for ; Sat, 26 Dec 2015 17:59:50 +0000 (UTC) Received: (qmail 94701 invoked by uid 500); 26 Dec 2015 17:59:49 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 94603 invoked by uid 500); 26 Dec 2015 17:59:49 -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 94592 invoked by uid 99); 26 Dec 2015 17:59:49 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Dec 2015 17:59:49 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 9E8F72C0AFA for ; Sat, 26 Dec 2015 17:59:49 +0000 (UTC) Date: Sat, 26 Dec 2015 17:59:49 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (MATH-1307) Create a base class for all RNGs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-1307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles updated MATH-1307: ------------------------- Attachment: BaseAbstractRandomGenerator.java Please have a look at the proposed code. Suggestions of a better name welcome. > Create a base class for all RNGs > -------------------------------- > > Key: MATH-1307 > URL: https://issues.apache.org/jira/browse/MATH-1307 > Project: Commons Math > Issue Type: Improvement > Reporter: Gilles > Assignee: Gilles > Priority: Minor > Labels: api, inheritance > Fix For: 4.0 > > Attachments: BaseAbstractRandomGenerator.java > > > I proposed to create a base class which the existing abstract classes {{AbstractRandomGenerator}} and {{BitsStreamGenerator}} will extend. > This would allow to define {{nextBytes(byte[])}} at the base class level. > The code for that method is almost identical in the two hierarchies: they only differ in a call to either {{nextInt()}} or {{next(32)}} respectively; the latter is however the same as the former, in disguise, and is not subject to change given the type of return value. > As a corollary, the new base class can be the unique place where to add utilities such as the one proposed in MATH-1306. -- This message was sent by Atlassian JIRA (v6.3.4#6332)