Use MAX_LENGTH constant for random length max

`MAX_LENGTH` wasn't being used.