Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2B3C4200B6A for ; Tue, 23 Aug 2016 00:02:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 29EE5160AB3; Mon, 22 Aug 2016 22:02:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A4FAF160ABD for ; Tue, 23 Aug 2016 00:02:11 +0200 (CEST) Received: (qmail 4289 invoked by uid 500); 22 Aug 2016 22:02:10 -0000 Mailing-List: contact notifications-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list notifications@commons.apache.org Received: (qmail 4280 invoked by uid 99); 22 Aug 2016 22:02:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Aug 2016 22:02:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 64CFDC0439 for ; Mon, 22 Aug 2016 22:02:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.374 X-Spam-Level: X-Spam-Status: No, score=0.374 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id O8QgA69x--Tj for ; Mon, 22 Aug 2016 22:02:04 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id D06CA5FBB5 for ; Mon, 22 Aug 2016 22:02:03 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B934EE58CB for ; Mon, 22 Aug 2016 22:02:01 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id E53783A321C for ; Mon, 22 Aug 2016 22:02:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r995697 [14/14] - in /websites/production/commons/content/proper/commons-rng: ./ apidocs/ apidocs/org/apache/commons/rng/ apidocs/org/apache/commons/rng/class-use/ apidocs/org/apache/commons/rng/internal/ apidocs/org/apache/commons/rng/inte... Date: Mon, 22 Aug 2016 22:01:59 -0000 To: notifications@commons.apache.org From: erans@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160822220200.E53783A321C@svn01-us-west.apache.org> archived-at: Mon, 22 Aug 2016 22:02:13 -0000 Modified: websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/BaseProvider.html ============================================================================== --- websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/BaseProvider.html (original) +++ websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/BaseProvider.html Mon Aug 22 22:01:58 2016 @@ -25,173 +25,143 @@ 17 18 package org.apache.commons.rng.internal; 19 -20 import java.util.Arrays; -21 import java.io.Serializable; -22 import org.apache.commons.rng.UniformRandomProvider; -23 import org.apache.commons.rng.RandomSource; -24 -25 /** -26 * Base class with default implementation for common methods. -27 */ -28 public abstract class BaseProvider -29 implements UniformRandomProvider, -30 StateSettable { -31 /** {@inheritDoc} */ -32 @Override -33 public int nextInt(int n) { -34 checkStrictlyPositive(n); -35 -36 if ((n & -n) == n) { -37 return (int) ((n * (long) (nextInt() >>> 1)) >> 31); -38 } -39 int bits; -40 int val; -41 do { -42 bits = nextInt() >>> 1; -43 val = bits % n; -44 } while (bits - val + (n - 1) < 0); -45 -46 return val; -47 } -48 -49 /** {@inheritDoc} */ -50 @Override -51 public long nextLong(long n) { -52 checkStrictlyPositive(n); -53 -54 long bits; -55 long val; -56 do { -57 bits = nextLong() >>> 1; -58 val = bits % n; -59 } while (bits - val + (n - 1) < 0); -60 -61 return val; -62 } -63 -64 /** {@inheritDoc} */ -65 @Override -66 public String toString() { -67 return getClass().getName(); -68 } -69 -70 /** {@inheritDoc} */ -71 @Override -72 public RandomSource.State getState() { -73 return new State(getStateInternal()); -74 } -75 -76 /** {@inheritDoc} */ -77 @Override -78 public void setState(RandomSource.State state) { -79 // Cast will intentionally fail if the argument is not one we created. -80 final State s = (State) state; -81 setStateInternal(s.getState()); -82 } -83 -84 /** -85 * Creates a snapshot of the RNG state. -86 * -87 * @return the internal state. -88 * @throws UnsupportedOperationException if not implemented. -89 */ -90 protected byte[] getStateInternal() { -91 throw new UnsupportedOperationException(); -92 } -93 -94 /** -95 * Resets the RNG to the given {@code state}. -96 * -97 * @param state State (previously obtained by a call to -98 * {@link #getStateInternal()}). -99 * @throws UnsupportedOperationException if not implemented. -100 * -101 * @see #checkStateSize(byte[],int) -102 */ -103 protected void setStateInternal(byte[] state) { -104 throw new UnsupportedOperationException(); -105 } -106 -107 /** -108 * Checks that the {@code state} has the {@code expected} size. -109 * -110 * @param state State. -111 * @param expected Expected length of {@code state} array. -112 * @throws IllegalArgumentException if {@code state.length != expected}. -113 */ -114 protected void checkStateSize(byte[] state, -115 int expected) { -116 if (state.length != expected) { -117 throw new IllegalArgumentException("State size must be " + expected + -118 " but was " + state.length); -119 } -120 } -121 -122 /** -123 * Checks whether {@code index} is in the range {@code [min, max]}. -124 * -125 * @param min Lower bound. -126 * @param max Upper bound. -127 * @param index Value that must lie within the {@code [min, max]} interval. -128 * @throws IndexOutOfBoundsException if {@code index} is not within the -129 * {@code [min, max]} interval. -130 */ -131 protected void checkIndex(int min, -132 int max, -133 int index) { -134 if (index < min || -135 index > max) { -136 throw new IndexOutOfBoundsException(index + " is out of interval [" + -137 min + ", " + -138 max + "]"); -139 } -140 } -141 -142 /** -143 * Checks that the argument is strictly positive. -144 * -145 * @param n Number to check. -146 * @throws IllegalArgumentException if {@code n <= 0}. -147 */ -148 private void checkStrictlyPositive(long n) { -149 if (n <= 0) { -150 throw new IllegalArgumentException("Must be strictly positive: " + n); -151 } -152 } -153 -154 /** -155 * "Black-box" state. -156 * Its sole purpose is to store all the data needed to recover -157 * the same state in order to restart a sequence where it left -158 * off. -159 * External code should not to modify the data contained in -160 * instances of this class. -161 */ -162 private static class State -163 implements RandomSource.State, -164 Serializable { -165 /** Serializable version identifier. */ -166 private static final long serialVersionUID = 4720160226L; -167 /** Internal state. */ -168 private byte[] state; -169 -170 /** -171 * @param state Mapping of all the data which a subclass of -172 * {@link BaseProvider} needs in order to reset its internal -173 * state. -174 */ -175 State(byte[] state) { -176 this.state = Arrays.copyOf(state, state.length); -177 } -178 -179 /** -180 * @return the internal state. -181 */ -182 byte[] getState() { -183 return Arrays.copyOf(state, state.length); -184 } -185 } -186 } +20 import org.apache.commons.rng.UniformRandomProvider; +21 +22 /** +23 * Base class with default implementation for common methods. +24 */ +25 public abstract class BaseProvider +26 implements UniformRandomProvider { +27 /** {@inheritDoc} */ +28 @Override +29 public int nextInt(int n) { +30 checkStrictlyPositive(n); +31 +32 if ((n & -n) == n) { +33 return (int) ((n * (long) (nextInt() >>> 1)) >> 31); +34 } +35 int bits; +36 int val; +37 do { +38 bits = nextInt() >>> 1; +39 val = bits % n; +40 } while (bits - val + (n - 1) < 0); +41 +42 return val; +43 } +44 +45 /** {@inheritDoc} */ +46 @Override +47 public long nextLong(long n) { +48 checkStrictlyPositive(n); +49 +50 long bits; +51 long val; +52 do { +53 bits = nextLong() >>> 1; +54 val = bits % n; +55 } while (bits - val + (n - 1) < 0); +56 +57 return val; +58 } +59 +60 /** {@inheritDoc} */ +61 @Override +62 public String toString() { +63 return getClass().getName(); +64 } +65 +66 /** +67 * Gets the instance's state. +68 * +69 * @return the current state. The given argument can then be passed +70 * to {@link #setState(byte[])} in order to recover the +71 * current state. +72 */ +73 public byte[] getState() { +74 return getStateInternal(); +75 } +76 +77 /** +78 * Sets the instance's state. +79 * +80 * @param state State. The given argument must have been retrieved +81 * by a call to {@link #getState()}. +82 */ +83 public void setState(byte[] state) { +84 setStateInternal(state); +85 } +86 +87 /** +88 * Creates a snapshot of the RNG state. +89 * +90 * @return the internal state. +91 * @throws UnsupportedOperationException if not implemented. +92 */ +93 protected byte[] getStateInternal() { +94 throw new UnsupportedOperationException(); +95 } +96 +97 /** +98 * Resets the RNG to the given {@code state}. +99 * +100 * @param state State (previously obtained by a call to +101 * {@link #getStateInternal()}). +102 * @throws UnsupportedOperationException if not implemented. +103 * +104 * @see #checkStateSize(byte[],int) +105 */ +106 protected void setStateInternal(byte[] state) { +107 throw new UnsupportedOperationException(); +108 } +109 +110 /** +111 * Checks that the {@code state} has the {@code expected} size. +112 * +113 * @param state State. +114 * @param expected Expected length of {@code state} array. +115 * @throws IllegalArgumentException if {@code state.length != expected}. +116 */ +117 protected void checkStateSize(byte[] state, +118 int expected) { +119 if (state.length != expected) { +120 throw new IllegalArgumentException("State size must be " + expected + +121 " but was " + state.length); +122 } +123 } +124 +125 /** +126 * Checks whether {@code index} is in the range {@code [min, max]}. +127 * +128 * @param min Lower bound. +129 * @param max Upper bound. +130 * @param index Value that must lie within the {@code [min, max]} interval. +131 * @throws IndexOutOfBoundsException if {@code index} is not within the +132 * {@code [min, max]} interval. +133 */ +134 protected void checkIndex(int min, +135 int max, +136 int index) { +137 if (index < min || +138 index > max) { +139 throw new IndexOutOfBoundsException(index + " is out of interval [" + +140 min + ", " + +141 max + "]"); +142 } +143 } +144 +145 /** +146 * Checks that the argument is strictly positive. +147 * +148 * @param n Number to check. +149 * @throws IllegalArgumentException if {@code n <= 0}. +150 */ +151 private void checkStrictlyPositive(long n) { +152 if (n <= 0) { +153 throw new IllegalArgumentException("Must be strictly positive: " + n); +154 } +155 } +156 }
Modified: websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-frame.html ============================================================================== --- websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-frame.html (original) +++ websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-frame.html Mon Aug 22 22:01:58 2016 @@ -27,12 +27,6 @@
  • RandomSourceInternal
  • -
  • - State -
  • -
  • - StateSettable -
  • Modified: websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-summary.html ============================================================================== --- websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-summary.html (original) +++ websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/package-summary.html Mon Aug 22 22:01:58 2016 @@ -55,16 +55,6 @@ RandomSourceInternal - - - State - - - - - StateSettable - - Modified: websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/source64/TwoCmres.html ============================================================================== --- websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/source64/TwoCmres.html (original) +++ websites/production/commons/content/proper/commons-rng/xref/org/apache/commons/rng/internal/source64/TwoCmres.html Mon Aug 22 22:01:58 2016 @@ -30,7 +30,7 @@ 22 import org.apache.commons.rng.internal.util.NumberFactory; 23 24 /** -25 * Random number generator designed by Mark D. Overton. +25 * Random number generator designed by Mark D.&nbsp;Overton. 26 * <p> 27 * It is one of the many generators described by the author in the following article series: 28 * <ul>