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 A608C1838A for ; Tue, 9 Feb 2016 16:22:18 +0000 (UTC) Received: (qmail 28281 invoked by uid 500); 9 Feb 2016 16:22:18 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 28176 invoked by uid 500); 9 Feb 2016 16:22:18 -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 28155 invoked by uid 99); 9 Feb 2016 16:22:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Feb 2016 16:22:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 143492C1F57 for ; Tue, 9 Feb 2016 16:22:18 +0000 (UTC) Date: Tue, 9 Feb 2016 16:22:18 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (MATH-1322) Negative integer seed for MersenneTwister is not working. 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-1322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15139141#comment-15139141 ] Gilles commented on MATH-1322: ------------------------------ With the code you wrote above: {code} MersenneTwister rng = new MersenneTwister(); rng.setSeed((int) -1); // Without patch, "-931718226" is output. // After applying patch, "419326371" is output. System.out.println(rng.nextInt()); {code} what is the output of {code} rng.setSeed((long) -1); {code} # in the current code and # with the patch applied ? > Negative integer seed for MersenneTwister is not working. > --------------------------------------------------------- > > Key: MATH-1322 > URL: https://issues.apache.org/jira/browse/MATH-1322 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.6 > Reporter: Morikawa Joe > Labels: patch > Attachments: MersenneTwister.patch > > > MersenneTwister.setSeed(int seed) has a bug. > If seed is negative, longMT also becomes negative. > First 32 bits are filled by 0xFFFFFFFF. > But it should be positive. First 32 bits should be filled by 0x00000000. > Ex) Integer -1 is 0xffffffff. > Long -1 is 0xffffffffffffffff. > Long 0xffffffff is 4294967295. > I created simple patch. -- This message was sent by Atlassian JIRA (v6.3.4#6332)