diff src/main/gov/nasa/jpf/util/OATHash.java @ 6:3a19eedcc13d

added a UniqueRandomPermGenerator that makes sure we don't return duplicates. It also checks the (unlikely and pointless) case that we request more permutations than N! and caps the number of samples accordingly
author Peter Mehlitz <Peter.C.Mehlitz@nasa.gov>
date Fri, 06 Feb 2015 10:12:12 -0800
parents 61d41facf527
children
line wrap: on
line diff
--- a/src/main/gov/nasa/jpf/util/OATHash.java	Thu Feb 05 19:13:42 2015 -0800
+++ b/src/main/gov/nasa/jpf/util/OATHash.java	Fri Feb 06 10:12:12 2015 -0800
@@ -84,6 +84,13 @@
     h = hashMixin( h, key3);
     
     return hashFinalize(h);
-    
+  }
+  
+  public static int hash (int[] keys){
+    int h = 0;
+    for (int i=0; i<keys.length; i++){
+      h = hashMixin( h, keys[i]);
+    }
+    return hashFinalize(h);
   }
 }