Fixes #5699

It's either this or change random Next() to silently ignore incorrect arguments.