Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 88679 invoked from network); 10 Jun 2007 14:29:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2007 14:29:54 -0000 Received: (qmail 77204 invoked by uid 500); 10 Jun 2007 14:29:57 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 77056 invoked by uid 500); 10 Jun 2007 14:29:57 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 77047 invoked by uid 99); 10 Jun 2007 14:29:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 07:29:57 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 07:29:53 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id F02B37141F6 for ; Sun, 10 Jun 2007 07:29:32 -0700 (PDT) Message-ID: <15589673.1181485772980.JavaMail.jira@brutus> Date: Sun, 10 Jun 2007 07:29:32 -0700 (PDT) From: "Albert Strasheim (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQCPP-125) Decaf: Random In-Reply-To: <237749.1181484693810.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQCPP-125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39244 ] Albert Strasheim commented on AMQCPP-125: ----------------------------------------- Okay, will do. :) > Decaf: Random > ------------- > > Key: AMQCPP-125 > URL: https://issues.apache.org/activemq/browse/AMQCPP-125 > Project: ActiveMQ C++ Client > Issue Type: New Feature > Affects Versions: 2.2 > Reporter: Albert Strasheim > Assignee: Nathan Mittler > Priority: Minor > Attachments: Randomv1.diff > > > Attached is a patch that implements a Random class that works the same as java.util.Random. This code can probably go into Decaf. The patch puts it in activemq/util for now. > I adapted the code from Harmony's implementation of Random: > http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Random.java?revision=530264&view=markup > I couldn't find a test for java.util.Random in the Harmony sources (just took a quick look), so I used the values from the Mauve test: > http://sources.redhat.com/cgi-bin/cvsweb.cgi/mauve/gnu/testlet/java/util/Random/basic.java?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=mauve > The Mauve tests are licensed under the GPL. Does using a few values from this test cause problems as far as licensing of this new code goes? Hopefully not. > The port to C++ was more or less straightforward. There were three main issues: > 1. C++ doesn't have >>>. If I understand >>> correctly, in C++ it's equivalent to doing >> on an unsigned type. > 2. You can't shift more than 31 places at a time in a portable manner. This is because at least the Intel shift instructions only look at the bottom 5 bits of the register that tells it how far to shift. As far as I know, the easiest solution is just to shift multiple times. > 3. Some java.util.Random methods are synchronized. I haven't included this functionality in the first version of the patch. It should be easy to add. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.