code: public static IntDoubleVector getRandomBernoulliDirection(int p) {
          IntDoubleVector e = new IntDoubleDenseVector(p);
          for (int i=0; i<p; i++) {
              // Bernoulli distribution chooses either positive or negative 1.
              e.set(i, (Prng.nextBoolean()) ? 1 : -1);
          }
          return e;
      }
docs: /* ----------- For random directions ------------