Modified to use /dev/urandom instead of random()