Change PRNG (fixes #1) and add missing input validation (fixes #2)

- Change the default PRNG to sjcl.random (uses native sources of
entropy when possible)
- Adds check for length of generated random numbers.
- Adds missing checks for illegal parameters.
- Adds basic input validation for all public methods.