small and secure string generator
I couldn't find something that works for me, so I made this.
the lib.js file exports two functions, ss and random.
the ss function takes two parameters, length (number) and characters (string).
it returns a string (which is the random generated string of the given length and characters).
the random function is a secure replacement for Math.random.
it makes use of crypto.getRandomValues since the Math.random function returns a floating-point, pseudo-random number, which is not entirely random.
import { ss, random } from 'https://often.github.io/ss/lib.js'
console.log(ss(10, '0123456789'))
console.log(ss(26, 'abcdefghijklmnopqrstuvwxyz'))
console.log(random())
console.log(Math.floor(random() * 10))