From issues-return-70145-archive-asf-public=cust-asf.ponee.io@commons.apache.org Mon Oct 8 14:14:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7BC2B18067A for ; Mon, 8 Oct 2018 14:14:03 +0200 (CEST) Received: (qmail 13345 invoked by uid 500); 8 Oct 2018 12:14:02 -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 13273 invoked by uid 99); 8 Oct 2018 12:14:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2018 12:14:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 08E1F180B80 for ; Mon, 8 Oct 2018 12:14:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Zk2qrMH9ill3 for ; Mon, 8 Oct 2018 12:14:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id CAEDB5F30F for ; Mon, 8 Oct 2018 12:14:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6944FE02EB for ; Mon, 8 Oct 2018 12:14:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3385C247C7 for ; Mon, 8 Oct 2018 12:14:00 +0000 (UTC) Date: Mon, 8 Oct 2018 12:14:00 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (RNG-57) CachedUniformRandomProvider for nextBoolean() and nextInt() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/RNG-57?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16641739= #comment-16641739 ]=20 Gilles commented on RNG-57: --------------------------- {quote}Because they are not all perfect. {quote} I was expecting the answer. {quote}The DieHarder results show that. {quote} Indeed. And it is unlikely that the unit tests of "Commons RNG" can do bett= er than the "Big Crush" test suite. Thus I don't think that we should evalu= ate the quality of the underlying source: the unit test should identify a b= ug in the Java implementation, not a flawed RNG algorithm. If the issue here is not a seed problem, we can make the build more robust = by setting the JUnit config to=C2=A0 repeat "flaky" tests.=C2=A0 If some RN= G sources fail more often than others, it is already a piece of information= , while being more tolerant for bad generators is not a good idea IMO. > CachedUniformRandomProvider for nextBoolean() and nextInt() > ----------------------------------------------------------- > > Key: RNG-57 > URL: https://issues.apache.org/jira/browse/RNG-57 > Project: Commons RNG > Issue Type: Improvement > Components: sampling > Affects Versions: 1.2 > Reporter: Alex D Herbert > Priority: Minor > Labels: performance > > Implement a wrapper around a {{UniformRandomProvider}} that can cache the= underlying source of random bytes for use in the methods {{nextBoolean()}}= and {{nextInt()}} (in the case of {{LongProvider}}). E.g. > {code:java} > LongProvider provider =3D RandomSource.create(RandomSource.SPLIT_MIX_64); > CachedLongProvider rng =3D new CachedLongProvider(provider); > // Uses cached nextLong() 64 times > rng.nextBoolean(); > // Uses cached nextLong() twice > rng.nextInt(); > IntProvider provider =3D RandomSource.create(RandomSource.KISS); > CachedIntProvider rng2 =3D new CachedIntProvider(provider); > // Uses cached nextInt() 32 times > rng2.nextBoolean(); > // This could be wrapped by a factory method: > UniformRandomProvider rng =3D CachedUniformRandomProviderFactory.wrap( > // Any supported source: IntProvider or LongProvider > RandomSource.create(RandomSource...)); > {code} > The implementation should be speed tested to determine the benefit for {{= nextBoolean()}} and if {{nextInt()}} can be improved for {{LongProviders}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)