updated to use /dev/urandom on Unix