added ability to set max random value.