Not sure how often this will be called, but if it's a lot then `isNaN` will take you and your children out back and beat you bloody. And it only checks for `NaN` values. `null` and `undefined` will fall through and skip past your next check. Also your error message is stated like the error could have been because `size > max`.

You have a bad state checking `=== 0`, which `false` will also fall through. Then a `0` will be passed to `binding.randomBytes`.

I'd just get rid if the first throw, and put it's error message in the second spot. Then change the next to `== 0`.