The result is wrong when calling random with large max. Below are the edge cases.
> random(9000000000000001)
83467816695816903274201855090766.0
> random(9000000000000000)
7878686929825859
Perhaps the easiest way to prevent this is to raise an error if max is too large.
This happens with both Chrome and Firefox on Mac