code: private static int getDeterministicAssignment(double[] distribution) {
      int assignment = -1;
      for (int i = 0; i < distribution.length; i++) {
        if (distribution[i] == 1.0) {
          if (assignment == -1) assignment = i;
          else return -1;
        } else if (distribution[i] != 0.0) return -1;
      }
      return assignment;
    }
docs: Finds the deterministic assignment forced by a distribution, or if none exists returns -1
  
  @param distribution the potentially deterministic distribution
  @return the assignment given by the distribution with probability 1, if one exists, else -1