}
@BIF
public static EObject rand_uniform_nif(EObject from, EObject to)
{
EBinary fb = from.testBinary();
EBinary tb = to.testBinary();
if (fb == null || tb == null) {
throw ERT.badarg(from, to);
}
BigInteger fi = mp2big(fb);
BigInteger ti = mp2big(tb);
if (log.isLoggable(Level.FINE)) log.fine("rand_uniform ("+fb+", "+tb+")");
BigInteger interval = ti.subtract(fi).subtract(BigInteger.ONE);
BigInteger base_value = new BigInteger(interval.bitLength(), rand);
BigInteger result;
while (interval.compareTo(base_value) == 1) {
base_value = new BigInteger(interval.bitLength(), rand);
}
result = fi.add(base_value);
if (log.isLoggable(Level.FINE)) log.fine("rand_uniform ("+fi+", "+ti+") -> "+result);
EBinary res = big2mp(result);
return res;
}