Make assumption more prominent.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/5f579ffc Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/5f579ffc Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/5f579ffc Branch: refs/heads/master Commit: 5f579ffc97e9450c0b9c62a9f1e455b34ad11d51 Parents: 0cd1df0 Author: Gilles <er...@apache.org> Authored: Thu Feb 22 11:45:53 2018 +0100 Committer: Gilles <er...@apache.org> Committed: Thu Feb 22 11:45:53 2018 +0100 ---------------------------------------------------------------------- .../org/apache/commons/rng/core/source32/AbstractWell.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-rng/blob/5f579ffc/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java ---------------------------------------------------------------------- diff --git a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java index d72a342..b181f30 100644 --- a/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java +++ b/commons-rng-core/src/main/java/org/apache/commons/rng/core/source32/AbstractWell.java @@ -38,6 +38,8 @@ import org.apache.commons.rng.core.util.NumberFactory; * @since 1.0 */ public abstract class AbstractWell extends IntProvider { + /** Block size. */ + private static final int BLOCK_SIZE = 32; /** Current index in the bytes pool. */ protected int index; /** Bytes pool. */ @@ -103,11 +105,10 @@ public abstract class AbstractWell extends IntProvider { * @return the number of 32-bits blocks. */ private static int calculateBlockCount(final int k) { - // the bits pool contains k bits, k = r w - p where r is the number + // The bits pool contains k bits, k = r w - p where r is the number // of w bits blocks, w is the block size (always 32 in the original paper) - // and p is the number of unused bits in the last block - final int w = 32; - return (k + w - 1) / w; + // and p is the number of unused bits in the last block. + return (k + BLOCK_SIZE - 1) / BLOCK_SIZE; } /**