RandomUtils>>isNotPrime throws IllegalArgumentException when argument is less 
than 2.
-------------------------------------------------------------------------------------

                 Key: MAHOUT-187
                 URL: https://issues.apache.org/jira/browse/MAHOUT-187
             Project: Mahout
          Issue Type: Bug
    Affects Versions: 0.1
            Reporter: Emerson Murphy-HIll


I was using a FastMap, which happened to be empty, and rehash() was called.  
Rehash eventually calls isNotPrime where n=1, which throws an illegal argument 
exception:

  public static boolean isNotPrime(int n) {
    if (n < 2) {
      throw new IllegalArgumentException();
    }

It seems to me anything less than two is not prime.  Thus, I suggest:

  public static boolean isNotPrime(int n) {
    if (n < 2) {
        return true;
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to