Rectangle3 implements Cloneable, Savable, Externalizable, ReadOnlyRectangle3, Poolable { @Override public Vector3 random(Vector3 result) { if (result == null) { result = new Vector3(); } final double s = MathUtils.nextRandomFloat(); final double t = MathUtils.nextRandomFloat(); final double aMod = 1.0 - s - t; final Vector3 temp1 = Vector3.fetchTempInstance(); final Vector3 temp2 = Vector3.fetchTempInstance(); final Vector3 temp3 = Vector3.fetchTempInstance(); result.set(_a.multiply(aMod, temp1).addLocal(_b.multiply(s, temp2).addLocal(_c.multiply(t, temp3)))); Vector3.releaseTempInstance(temp1); Vector3.releaseTempInstance(temp2); Vector3.releaseTempInstance(temp3); return result; } Rectangle3();  Rectangle3(final ReadOnlyRectangle3 source);  Rectangle3(final ReadOnlyVector3 a, final ReadOnlyVector3 b, final ReadOnlyVector3 c); Rectangle3 set(final ReadOnlyRectangle3 source); @Override ReadOnlyVector3 getA(); void setA(final ReadOnlyVector3 a); @Override ReadOnlyVector3 getB(); void setB(final ReadOnlyVector3 b); @Override ReadOnlyVector3 getC(); void setC(final ReadOnlyVector3 c); @Override Vector3 random(Vector3 result); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object o); @Override Rectangle3 clone(); @Override void write(final OutputCapsule capsule); @Override void read(final InputCapsule capsule); @Override Class<? extends Rectangle3> getClassTag(); @Override void readExternal(final ObjectInput in); @Override void writeExternal(final ObjectOutput out); final static Rectangle3 fetchTempInstance(); final static void releaseTempInstance(final Rectangle3 rectangle);  }
@Test public void testRandom() { MathUtils.setRandomSeed(0); final Rectangle3 rect1 = new Rectangle3(); final Vector3 store = rect1.random(null); assertEquals(new Vector3(0.0, 0.0, 0.0), store); rect1.setA(new Vector3(1, 0, 0)); rect1.setB(new Vector3(1, 1, 0)); rect1.setC(new Vector3(0, 1, 0)); rect1.random(store); assertEquals(new Vector3(0.39365482330322266, 0.8468815684318542, 0.0), store); }