Code example for Random

Methods: nextFloat

0
    VectorsTestsUtils.assertEquals(pa, a);
    VectorsTestsUtils.assertEquals(pb, b);
    VectorsTestsUtils.assertEquals(pa.add(pb), a.add(b));
    VectorsTestsUtils.assertEquals(pa.subtract(pb), a.subtract(b));
    VectorsTestsUtils.assertEquals(pa.ebeMultiply(pb), a.ebeMultiply(b));
    float factor = random.nextFloat();
    VectorsTestsUtils.assertEquals(pa.addToSelf(factor, pb), a.add(b.mapMultiply(factor)));
  } 
 
  private BVector createRandomBVector(int maxActive, int size) {
    BVector result = new BVector(size);
    int nbActive = random.nextInt(maxActive);
    for (int i = 0; i < nbActive; i++)
      result.setOn(random.nextInt(size));
    return result;
  } 
 
  private SVector createRandomSVector(int maxActive, int size) {
    SVector result = newPrototypeVector(size);
    int nbActive = random.nextInt(maxActive);
Experience pair programming with AI  Get Codota for Java