Can this secure, random generator be improved?
I agree with @Bobby. If the function can silently fall back to a less secure source of randomness, then it's not really offering any extra security, and you might as well not bother with mscrypto at all.

Verbesserungsvorschlag:

function randomString(length, allowRandomSourceFallback) {
    ...
}


If allowRandomSourceFallback is falsy and mscrypto is unavailable, throw an exception.