You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2013/01/15 18:21:28 UTC
git commit: remove gms cruft
Updated Branches:
refs/heads/cassandra-1.1 4faed779d -> 233ea266c
remove gms cruft
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/233ea266
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/233ea266
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/233ea266
Branch: refs/heads/cassandra-1.1
Commit: 233ea266c841f100345c30666c32bd2be29cd43b
Parents: 4faed77
Author: Brandon Williams <br...@apache.org>
Authored: Tue Jan 15 11:20:48 2013 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Jan 15 11:20:48 2013 -0600
----------------------------------------------------------------------
src/java/org/apache/cassandra/gms/PureRandom.java | 81 ----------------
1 files changed, 0 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/233ea266/src/java/org/apache/cassandra/gms/PureRandom.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/PureRandom.java b/src/java/org/apache/cassandra/gms/PureRandom.java
deleted file mode 100644
index 1bbc632..0000000
--- a/src/java/org/apache/cassandra/gms/PureRandom.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cassandra.gms;
-
-import java.util.BitSet;
-import java.util.Random;
-
-
-/**
- * Implementation of a PureRandomNumber generator. Use this class cautiously. Not
- * for general purpose use. Currently this is used by the Gossiper to choose a random
- * endpoint to Gossip to.
- */
-
-class PureRandom extends Random
-{
- private BitSet bs_ = new BitSet();
- private int lastUb_;
-
- PureRandom()
- {
- super();
- }
-
- public int nextInt(int ub)
- {
- if (ub <= 0)
- throw new IllegalArgumentException("ub must be positive");
-
- if ( lastUb_ != ub )
- {
- bs_.clear();
- lastUb_ = ub;
- }
- else if(bs_.cardinality() == ub)
- {
- bs_.clear();
- }
-
- int value = super.nextInt(ub);
- while ( bs_.get(value) )
- {
- value = super.nextInt(ub);
- }
- bs_.set(value);
- return value;
- }
-
- public static void main(String[] args) throws Throwable
- {
- Random pr = new PureRandom();
- int ubs[] = new int[] { 2, 3, 1, 10, 5, 0};
-
- for (int ub : ubs)
- {
- System.out.println("UB: " + String.valueOf(ub));
- for (int j = 0; j < 10; j++)
- {
- int junk = pr.nextInt(ub);
- // Do something with junk so JVM doesn't optimize away
- System.out.println(junk);
- }
- }
- }
-}