for (int i = 0; i < length; i++) {
for (int i = 0; i < num; i++) {
  public Value array_rand(Env env, ArrayValue array, @Optional("1") long num)    throws Throwable  {    if (array == null)      return NullValue.NULL;    if (array.getSize() == 0)      return NullValue.NULL;    if (num < 1 || array.getSize() < num) {      env.warning("Second argument has to be between 1 and the number of " +        "elements in the array");      return NullValue.NULL;    }    long arraySize = array.getSize();    Value[] keys = new Value[(int) arraySize];    array.keySet().toArray(keys);    if (num == 1) {      int index = (int) (RandomUtil.getRandomLong() % arraySize);      if (index < 0)        index *= -1;      return (Value) keys[index];    }    int length = keys.length;    for (int i = 0; i < length; i++) {      int rand = RandomUtil.nextInt(length);      Value temp = keys[rand];      keys[rand] = keys[i];      keys[i] = temp;    }    ArrayValue randArray = new ArrayValueImpl();    for (int i = 0; i < length; i++) {      randArray.put(keys[i]);    }    return randArray;  }